disable context menu for non-file system objects

svn path=/trunk/; revision=8706
This commit is contained in:
Martin Fuchs 2004-03-14 12:06:25 +00:00
parent d13e1cf220
commit 5ca99eb505
8 changed files with 47 additions and 33 deletions

View file

@ -30,16 +30,12 @@
- Startmenu: You can't close the start menu with pressing Win-key You can open the start menu
with pressing Win-key, but can't close with another hit of Win-key.
- Despite of settings, the clock's always shown I set my Win-Exp to hide the clock shown in
the taskbar, but the ROS-Exp ignores the setting and always shows the clock.
- > Despite of settings, the clock's always shown I set my Win-Explorer to hide the clock
> shown in the taskbar, but the ROS-Exp ignores the setting and always shows the clock.
Yes, ROS explorer doesn't read many settings from the registry currently,
as it doesn't have a way to configure them. (missing configuration dialogs)
- Wenn man in der Toolbar auf "NT Obj." klickt und dann mit der rechten
Maustaste in die TreeView klickt, gibt es eine COM Exeption "Falscher Parameter".
Wenn man das öfter macht crasht das Programm.
- Es scheint ein paar GDI-Leaks in deinem Programm zu geben…
- Es scheint ein paar GDI-Leaks in deinem Programm zu geben.
Wenn man ein neues MDI Fenster öffnet und dann wieder schließt, werden
einige GDI-Objekte nicht wieder gelöscht
einige GDI-Objekte nicht wieder gelöscht.

View file

@ -315,19 +315,6 @@ void Entry::smart_scan(int scan_flags)
}
ShellPath Entry::create_absolute_pidl() const
{
CONTEXT("Entry::create_absolute_pidl()");
TCHAR path[MAX_PATH];
if (get_path(path))
return ShellPath(path);
return ShellPath();
}
void Entry::extract_icon()
{
TCHAR path[MAX_PATH];

View file

@ -109,7 +109,7 @@ public:
virtual const void* get_next_path_component(const void*) {return NULL;}
virtual Entry* find_entry(const void*) {return NULL;}
virtual bool get_path(PTSTR path) const = 0;
virtual ShellPath create_absolute_pidl() const;
virtual ShellPath create_absolute_pidl() const {return (LPCITEMIDLIST)NULL;}
virtual HRESULT GetUIObjectOf(HWND hWnd, REFIID riid, LPVOID* ppvOut);
virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL);
};

View file

@ -293,6 +293,21 @@ bool FATEntry::get_path(PTSTR path) const
return true;
}
ShellPath FATEntry::create_absolute_pidl() const
{
CONTEXT("WinEntry::create_absolute_pidl()");
return (LPCITEMIDLIST)NULL;
/* prepend root path if the drive is currently actually mounted in the file system -> return working PIDL
TCHAR path[MAX_PATH];
if (get_path(path))
return ShellPath(path);
return ShellPath();
*/
}
FATDirectory::FATDirectory(FATDrive& drive, LPCTSTR root_path)
: FATEntry(),

View file

@ -35,6 +35,7 @@ protected:
FATEntry() : Entry(ET_FAT) {}
virtual bool get_path(PTSTR path) const;
virtual ShellPath create_absolute_pidl() const;
DWORD _cluster;
};

View file

@ -501,22 +501,24 @@ LRESULT FileChildWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
ShellPath shell_path = entry->create_absolute_pidl();
LPCITEMIDLIST pidl_abs = shell_path;
IShellFolder* parentFolder;
LPCITEMIDLIST pidlLast;
if (pidl_abs) {
IShellFolder* parentFolder;
LPCITEMIDLIST pidlLast;
static DynamicFct<HRESULT(WINAPI*)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*)> SHBindToParent(TEXT("SHELL32"), "SHBindToParent");
static DynamicFct<HRESULT(WINAPI*)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*)> SHBindToParent(TEXT("SHELL32"), "SHBindToParent");
if (SHBindToParent) {
// get and use the parent folder to display correct context menu in all cases -> correct "Properties" dialog for directories, ...
if (SUCCEEDED((*SHBindToParent)(pidl_abs, IID_IShellFolder, (LPVOID*)&parentFolder, &pidlLast))) {
HRESULT hr = ShellFolderContextMenu(parentFolder, _hwnd, 1, &pidlLast, pos.x, pos.y);
if (SHBindToParent) {
// get and use the parent folder to display correct context menu in all cases -> correct "Properties" dialog for directories, ...
if (SUCCEEDED((*SHBindToParent)(pidl_abs, IID_IShellFolder, (LPVOID*)&parentFolder, &pidlLast))) {
HRESULT hr = ShellFolderContextMenu(parentFolder, _hwnd, 1, &pidlLast, pos.x, pos.y);
parentFolder->Release();
parentFolder->Release();
CHECKERROR(hr);
CHECKERROR(hr);
}
} else {
CHECKERROR(ShellFolderContextMenu(GetDesktopFolder(), _hwnd, 1, &pidl_abs, pos.x, pos.y));
}
} else {
CHECKERROR(ShellFolderContextMenu(GetDesktopFolder(), _hwnd, 1, &pidl_abs, pos.x, pos.y));
}
}
break;}

View file

@ -280,3 +280,15 @@ bool WinEntry::get_path(PTSTR path) const
return true;
}
ShellPath WinEntry::create_absolute_pidl() const
{
CONTEXT("WinEntry::create_absolute_pidl()");
TCHAR path[MAX_PATH];
if (get_path(path))
return ShellPath(path);
return ShellPath();
}

View file

@ -35,6 +35,7 @@ protected:
WinEntry() : Entry(ET_WINDOWS) {}
virtual bool get_path(PTSTR path) const;
virtual ShellPath create_absolute_pidl() const;
};