mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 20:55:16 +00:00
Implemented navigation and launching in start menu
svn path=/trunk/; revision=5675
This commit is contained in:
parent
a0f1b6fbfe
commit
02a714f2b9
|
@ -1,7 +1,13 @@
|
||||||
2003-08-16 Martin Fuchs <martin-fuchs@gmx.net>
|
2003-08-19 Martin Fuchs <martin-fuchs@gmx.net>
|
||||||
|
|
||||||
|
* subsys/system/explorer/taskbar/startmenu.cpp:
|
||||||
|
Implemented navigation in submenus of the start menu.
|
||||||
|
Start menus can now resolve shortcuts and launch programs.
|
||||||
|
|
||||||
|
2003-08-18 Martin Fuchs <martin-fuchs@gmx.net>
|
||||||
|
|
||||||
* subsys/system/explorer/taskbar/taskbar.cpp:
|
* subsys/system/explorer/taskbar/taskbar.cpp:
|
||||||
first draft of explorer start menu
|
First draft of explorer start menu.
|
||||||
|
|
||||||
2003-08-17 James Tabor <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
|
2003-08-17 James Tabor <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
|
|
||||||
#include "explorer.h"
|
#include "explorer.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "externals.h"
|
||||||
|
|
||||||
#include "explorer_intres.h"
|
#include "explorer_intres.h"
|
||||||
#include "externals.h"
|
|
||||||
|
|
||||||
|
|
||||||
ExplorerGlobals g_Globals;
|
ExplorerGlobals g_Globals;
|
||||||
|
@ -118,6 +118,10 @@ int explorer_main(HINSTANCE hInstance, HWND hwndDesktop, int cmdshow)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InitInstance(hInstance);
|
InitInstance(hInstance);
|
||||||
|
} catch(COMException& e) {
|
||||||
|
HandleException(e, g_Globals._hMainWnd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (hwndDesktop)
|
if (hwndDesktop)
|
||||||
g_Globals._desktop_mode = true;
|
g_Globals._desktop_mode = true;
|
||||||
|
@ -133,11 +137,6 @@ int explorer_main(HINSTANCE hInstance, HWND hwndDesktop, int cmdshow)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Window::MessageLoop();
|
return Window::MessageLoop();
|
||||||
} catch(COMException& e) {
|
|
||||||
HandleException(e, g_Globals._hMainWnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
CFG=explorer - Win32 Unicode Debug
|
CFG=explorer - Win32 _NO_COMUTIL
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
!MESSAGE use the Export Makefile command and run
|
!MESSAGE use the Export Makefile command and run
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
@ -13,7 +13,7 @@ CFG=explorer - Win32 Unicode Debug
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "explorer.mak" CFG="explorer - Win32 Unicode Debug"
|
!MESSAGE NMAKE /f "explorer.mak" CFG="explorer - Win32 _NO_COMUTIL"
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE Possible choices for configuration are:
|
!MESSAGE Possible choices for configuration are:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
@ -22,6 +22,7 @@ CFG=explorer - Win32 Unicode Debug
|
||||||
!MESSAGE "explorer - Win32 Debug Release" (based on "Win32 (x86) Console Application")
|
!MESSAGE "explorer - Win32 Debug Release" (based on "Win32 (x86) Console Application")
|
||||||
!MESSAGE "explorer - Win32 Unicode Release" (based on "Win32 (x86) Console Application")
|
!MESSAGE "explorer - Win32 Unicode Release" (based on "Win32 (x86) Console Application")
|
||||||
!MESSAGE "explorer - Win32 Unicode Debug" (based on "Win32 (x86) Console Application")
|
!MESSAGE "explorer - Win32 Unicode Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "explorer - Win32 _NO_COMUTIL" (based on "Win32 (x86) Console Application")
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
|
||||||
# Begin Project
|
# Begin Project
|
||||||
|
@ -159,6 +160,33 @@ LINK32=link.cmd
|
||||||
# ADD LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
# ADD LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
# SUBTRACT LINK32 /pdb:none
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "explorer - Win32 _NO_COMUTIL"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "explorer___Win32__NO_COMUTIL"
|
||||||
|
# PROP BASE Intermediate_Dir "explorer___Win32__NO_COMUTIL"
|
||||||
|
# PROP BASE Ignore_Export_Lib 0
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "_NO_COMUTIL"
|
||||||
|
# PROP Intermediate_Dir "_NO_COMUTIL"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_ROS_" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_ROS_" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /D "_NO_COMUTIL" /FR /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.cmd
|
||||||
|
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
|
# SUBTRACT BASE LINK32 /pdb:none
|
||||||
|
# ADD LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# Begin Target
|
# Begin Target
|
||||||
|
@ -168,6 +196,7 @@ LINK32=link.cmd
|
||||||
# Name "explorer - Win32 Debug Release"
|
# Name "explorer - Win32 Debug Release"
|
||||||
# Name "explorer - Win32 Unicode Release"
|
# Name "explorer - Win32 Unicode Release"
|
||||||
# Name "explorer - Win32 Unicode Debug"
|
# Name "explorer - Win32 Unicode Debug"
|
||||||
|
# Name "explorer - Win32 _NO_COMUTIL"
|
||||||
# Begin Group "utility"
|
# Begin Group "utility"
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
|
@ -241,6 +270,11 @@ SOURCE=.\de.rc
|
||||||
# PROP BASE Exclude_From_Build 1
|
# PROP BASE Exclude_From_Build 1
|
||||||
# PROP Exclude_From_Build 1
|
# PROP Exclude_From_Build 1
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "explorer - Win32 _NO_COMUTIL"
|
||||||
|
|
||||||
|
# PROP BASE Exclude_From_Build 1
|
||||||
|
# PROP Exclude_From_Build 1
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
|
@ -274,6 +308,11 @@ SOURCE=.\en.rc
|
||||||
# PROP BASE Exclude_From_Build 1
|
# PROP BASE Exclude_From_Build 1
|
||||||
# PROP Exclude_From_Build 1
|
# PROP Exclude_From_Build 1
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "explorer - Win32 _NO_COMUTIL"
|
||||||
|
|
||||||
|
# PROP BASE Exclude_From_Build 1
|
||||||
|
# PROP Exclude_From_Build 1
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
|
@ -327,6 +366,11 @@ SOURCE=.\resource.rc
|
||||||
# PROP BASE Exclude_From_Build 1
|
# PROP BASE Exclude_From_Build 1
|
||||||
# PROP Exclude_From_Build 1
|
# PROP Exclude_From_Build 1
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "explorer - Win32 _NO_COMUTIL"
|
||||||
|
|
||||||
|
# PROP BASE Exclude_From_Build 1
|
||||||
|
# PROP Exclude_From_Build 1
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
@ -42,6 +42,7 @@ Entry::Entry(ENTRY_TYPE etype)
|
||||||
_down = NULL;
|
_down = NULL;
|
||||||
_expanded = false;
|
_expanded = false;
|
||||||
_scanned = false;
|
_scanned = false;
|
||||||
|
_bhfi_valid = false;
|
||||||
_level = 0;
|
_level = 0;
|
||||||
_hicon = 0;
|
_hicon = 0;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +55,7 @@ Entry::Entry(Entry* parent)
|
||||||
_down = NULL;
|
_down = NULL;
|
||||||
_expanded = false;
|
_expanded = false;
|
||||||
_scanned = false;
|
_scanned = false;
|
||||||
|
_bhfi_valid = false;
|
||||||
_level = 0;
|
_level = 0;
|
||||||
_hicon = 0;
|
_hicon = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,14 +60,14 @@ public:
|
||||||
|
|
||||||
WIN32_FIND_DATA _data;
|
WIN32_FIND_DATA _data;
|
||||||
|
|
||||||
BY_HANDLE_FILE_INFORMATION _bhfi;
|
|
||||||
bool _bhfi_valid;
|
|
||||||
|
|
||||||
SFGAOF _shell_attribs;
|
SFGAOF _shell_attribs;
|
||||||
|
|
||||||
ENTRY_TYPE _etype;
|
ENTRY_TYPE _etype;
|
||||||
HICON _hicon;
|
HICON _hicon;
|
||||||
|
|
||||||
|
BY_HANDLE_FILE_INFORMATION _bhfi;
|
||||||
|
bool _bhfi_valid;
|
||||||
|
|
||||||
void free_subentries();
|
void free_subentries();
|
||||||
|
|
||||||
void read_directory(SORT_ORDER sortOrder);
|
void read_directory(SORT_ORDER sortOrder);
|
||||||
|
@ -78,8 +78,8 @@ public:
|
||||||
virtual void read_directory() {}
|
virtual void read_directory() {}
|
||||||
virtual const void* get_next_path_component(const void*) {return NULL;}
|
virtual const void* get_next_path_component(const void*) {return NULL;}
|
||||||
virtual Entry* find_entry(const void*) {return NULL;}
|
virtual Entry* find_entry(const void*) {return NULL;}
|
||||||
virtual void get_path(PTSTR path) = 0;
|
virtual void get_path(PTSTR path) const = 0;
|
||||||
virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow);
|
virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Directory {
|
struct Directory {
|
||||||
|
|
|
@ -80,7 +80,7 @@ FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
|
||||||
lstrcpy(_root._fs, TEXT("Shell"));
|
lstrcpy(_root._fs, TEXT("Shell"));
|
||||||
|
|
||||||
const ShellChildWndInfo& shell_info = static_cast<const ShellChildWndInfo&>(info);
|
const ShellChildWndInfo& shell_info = static_cast<const ShellChildWndInfo&>(info);
|
||||||
_root._entry = new ShellDirectory(Desktop(), shell_info._shell_path, hwnd);
|
_root._entry = new ShellDirectory(Desktop(), DesktopFolder(), hwnd);
|
||||||
entry = _root._entry->read_tree((LPCTSTR)&*shell_info._shell_path, SORT_NAME/*_sortOrder*/);
|
entry = _root._entry->read_tree((LPCTSTR)&*shell_info._shell_path, SORT_NAME/*_sortOrder*/);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -111,10 +111,10 @@ FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
|
||||||
entry = _root._entry->read_tree(info._path, SORT_NAME/*_sortOrder*/);
|
entry = _root._entry->read_tree(info._path, SORT_NAME/*_sortOrder*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info._etype == ET_SHELL)
|
if (info._etype != ET_SHELL)
|
||||||
lstrcpy(_root._entry->_data.cFileName, TEXT("Desktop"));
|
|
||||||
else
|
|
||||||
wsprintf(_root._entry->_data.cFileName, TEXT("%s - %s"), drv, _root._fs);
|
wsprintf(_root._entry->_data.cFileName, TEXT("%s - %s"), drv, _root._fs);
|
||||||
|
/*@@else
|
||||||
|
lstrcpy(_root._entry->_data.cFileName, TEXT("Desktop"));*/
|
||||||
|
|
||||||
_root._entry->_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
|
_root._entry->_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ void FileChildWindow::activate_entry(Pane* pane, HWND hwnd)
|
||||||
pane->set_header();
|
pane->set_header();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
entry->launch_entry(_hwnd, SW_SHOWNORMAL);
|
entry->launch_entry(_hwnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,13 +113,14 @@ void ShellBrowserChild::InitializeTree(/*const FileChildWndInfo& info*/)
|
||||||
lstrcpy(_root._fs, TEXT("Shell"));
|
lstrcpy(_root._fs, TEXT("Shell"));
|
||||||
|
|
||||||
|
|
||||||
//@@ _root._entry->read_tree(ShellFolder(shell_info._root_shell_path), info._shell_path, SORT_NAME/*_sortOrder*/);
|
//@@ _root._entry->read_tree(shell_info._root_shell_path.get_folder(), info._shell_path, SORT_NAME/*_sortOrder*/);
|
||||||
|
|
||||||
//@@ fängt zunächst nur einmal mit dem Desktop-Objekt an
|
//@@ should call read_tree() here; see FileChildWindow::FileChildWindow()
|
||||||
_root._entry = new ShellDirectory(Desktop(), DesktopFolder(), _hwnd);
|
_root._entry = new ShellDirectory(Desktop(), DesktopFolder(), _hwnd);
|
||||||
_root._entry->read_directory();
|
_root._entry->read_directory();
|
||||||
|
|
||||||
lstrcpy(_root._entry->_data.cFileName, TEXT("Desktop"));
|
/* already filled by ShellDirectory constructor
|
||||||
|
lstrcpy(_root._entry->_data.cFileName, TEXT("Desktop")); */
|
||||||
|
|
||||||
|
|
||||||
TV_ITEM tvItem;
|
TV_ITEM tvItem;
|
||||||
|
@ -359,7 +360,7 @@ void ShellBrowserChild::OnTreeItemSelected(int idCtrl, LPNMTREEVIEW pnmtv)
|
||||||
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
folder = static_cast<ShellDirectory*>(entry)->_folder;
|
folder = static_cast<ShellDirectory*>(entry)->_folder;
|
||||||
else
|
else
|
||||||
folder = entry->_up? static_cast<ShellDirectory*>(entry->_up)->_folder: Desktop();
|
folder = entry->get_parent_folder();
|
||||||
|
|
||||||
if (!folder) {
|
if (!folder) {
|
||||||
assert(folder);
|
assert(folder);
|
||||||
|
|
|
@ -115,18 +115,16 @@ LPITEMIDLIST ShellEntry::create_absolute_pidl(HWND hwnd)
|
||||||
|
|
||||||
|
|
||||||
// get full path of a shell entry
|
// get full path of a shell entry
|
||||||
void ShellEntry::get_path(PTSTR path)
|
void ShellEntry::get_path(PTSTR path) const
|
||||||
{
|
{
|
||||||
path[0] = TEXT('\0');
|
path[0] = TEXT('\0');
|
||||||
|
|
||||||
IShellFolder* parent = _up? static_cast<ShellDirectory*>(_up)->_folder: Desktop();
|
HRESULT hr = path_from_pidl(get_parent_folder(), &*_pidl, path, MAX_PATH);
|
||||||
|
|
||||||
HRESULT hr = path_from_pidl(parent, &*_pidl, path, MAX_PATH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get full path of a shell folder
|
// get full path of a shell folder
|
||||||
void ShellDirectory::get_path(PTSTR path)
|
void ShellDirectory::get_path(PTSTR path) const
|
||||||
{
|
{
|
||||||
path[0] = TEXT('\0');
|
path[0] = TEXT('\0');
|
||||||
|
|
||||||
|
@ -134,13 +132,10 @@ void ShellDirectory::get_path(PTSTR path)
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
if (!_folder.empty())
|
if (!_folder.empty())
|
||||||
hr = _folder->GetAttributesOf(1, (LPCITEMIDLIST*)&_pidl, &attribs);
|
hr = const_cast<ShellFolder&>(_folder)->GetAttributesOf(1, (LPCITEMIDLIST*)&_pidl, &attribs);
|
||||||
|
|
||||||
if (SUCCEEDED(hr) && (attribs&SFGAO_FILESYSTEM)) {
|
if (SUCCEEDED(hr) && (attribs&SFGAO_FILESYSTEM))
|
||||||
IShellFolder* parent = _up? static_cast<ShellDirectory*>(_up)->_folder: Desktop();
|
hr = path_from_pidl(get_parent_folder(), &*_pidl, path, MAX_PATH);
|
||||||
|
|
||||||
hr = path_from_pidl(parent, &*_pidl, path, MAX_PATH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,10 @@ struct ShellEntry : public Entry
|
||||||
ShellEntry(Entry* parent, LPITEMIDLIST shell_path) : Entry(parent), _pidl(shell_path) {}
|
ShellEntry(Entry* parent, LPITEMIDLIST shell_path) : Entry(parent), _pidl(shell_path) {}
|
||||||
ShellEntry(Entry* parent, const ShellPath& shell_path) : Entry(parent), _pidl(shell_path) {}
|
ShellEntry(Entry* parent, const ShellPath& shell_path) : Entry(parent), _pidl(shell_path) {}
|
||||||
|
|
||||||
virtual void get_path(PTSTR path);
|
virtual void get_path(PTSTR path) const;
|
||||||
virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow);
|
virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL);
|
||||||
|
|
||||||
|
IShellFolder* get_parent_folder() const;
|
||||||
LPITEMIDLIST create_absolute_pidl(HWND hwnd);
|
LPITEMIDLIST create_absolute_pidl(HWND hwnd);
|
||||||
|
|
||||||
ShellPath _pidl;
|
ShellPath _pidl;
|
||||||
|
@ -43,6 +44,7 @@ protected:
|
||||||
ShellEntry(const ShellPath& shell_path) : Entry(ET_SHELL), _pidl(shell_path) {}
|
ShellEntry(const ShellPath& shell_path) : Entry(ET_SHELL), _pidl(shell_path) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ShellDirectory : public ShellEntry, public Directory
|
struct ShellDirectory : public ShellEntry, public Directory
|
||||||
{
|
{
|
||||||
ShellDirectory(IShellFolder* shell_root, const ShellPath& shell_path, HWND hwnd)
|
ShellDirectory(IShellFolder* shell_root, const ShellPath& shell_path, HWND hwnd)
|
||||||
|
@ -50,17 +52,26 @@ struct ShellDirectory : public ShellEntry, public Directory
|
||||||
_folder(shell_root, shell_path),
|
_folder(shell_root, shell_path),
|
||||||
_hwnd(hwnd)
|
_hwnd(hwnd)
|
||||||
{
|
{
|
||||||
|
lstrcpy(_data.cFileName, ShellFolder(shell_root).get_name(shell_path));
|
||||||
|
_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
|
||||||
|
_shell_attribs = SFGAO_FOLDER;
|
||||||
|
|
||||||
ShellFolder folder(shell_root, shell_path);
|
ShellFolder folder(shell_root, shell_path);
|
||||||
IShellFolder* pFolder = folder;
|
IShellFolder* pFolder = folder;
|
||||||
pFolder->AddRef();
|
pFolder->AddRef();
|
||||||
_path = pFolder;
|
_path = pFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellDirectory(ShellDirectory* parent, IShellFolder* shell_root, LPITEMIDLIST shell_path, HWND hwnd)
|
explicit ShellDirectory(ShellDirectory* parent, IShellFolder* shell_root, LPITEMIDLIST shell_path, HWND hwnd)
|
||||||
: ShellEntry(parent, shell_path),
|
: ShellEntry(parent, shell_path),
|
||||||
_folder(shell_root),
|
_folder(shell_root),
|
||||||
_hwnd(hwnd)
|
_hwnd(hwnd)
|
||||||
{
|
{
|
||||||
|
/* not neccessary - the caller will fill the info
|
||||||
|
lstrcpy(_data.cFileName, _folder.get_name(shell_path));
|
||||||
|
_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
|
||||||
|
_shell_attribs = SFGAO_FOLDER; */
|
||||||
|
|
||||||
shell_root->AddRef();
|
shell_root->AddRef();
|
||||||
_path = shell_root;
|
_path = shell_root;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +87,7 @@ struct ShellDirectory : public ShellEntry, public Directory
|
||||||
virtual const void* get_next_path_component(const void*);
|
virtual const void* get_next_path_component(const void*);
|
||||||
virtual Entry* find_entry(const void* p);
|
virtual Entry* find_entry(const void* p);
|
||||||
|
|
||||||
virtual void get_path(PTSTR path);
|
virtual void get_path(PTSTR path) const;
|
||||||
|
|
||||||
ShellFolder _folder;
|
ShellFolder _folder;
|
||||||
HWND _hwnd;
|
HWND _hwnd;
|
||||||
|
@ -84,3 +95,12 @@ struct ShellDirectory : public ShellEntry, public Directory
|
||||||
protected:
|
protected:
|
||||||
bool fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA*, BY_HANDLE_FILE_INFORMATION*);
|
bool fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA*, BY_HANDLE_FILE_INFORMATION*);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline IShellFolder* ShellEntry::get_parent_folder() const
|
||||||
|
{
|
||||||
|
if (_up)
|
||||||
|
return static_cast<ShellDirectory*>(_up)->_folder;
|
||||||
|
else
|
||||||
|
return Desktop();
|
||||||
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ Entry* UnixDirectory::find_entry(const void* p)
|
||||||
|
|
||||||
|
|
||||||
// get full path of specified directory entry
|
// get full path of specified directory entry
|
||||||
void UnixEntry::get_path(PTSTR path)
|
void UnixEntry::get_path(PTSTR path) const
|
||||||
{
|
{
|
||||||
int level = 0;
|
int level = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct UnixEntry : public Entry
|
||||||
protected:
|
protected:
|
||||||
UnixEntry() : Entry(ET_UNIX) {}
|
UnixEntry() : Entry(ET_UNIX) {}
|
||||||
|
|
||||||
virtual void get_path(PTSTR path);
|
virtual void get_path(PTSTR path) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UnixDirectory : public UnixEntry, public Directory
|
struct UnixDirectory : public UnixEntry, public Directory
|
||||||
|
|
|
@ -140,12 +140,12 @@ Entry* WinDirectory::find_entry(const void* p)
|
||||||
|
|
||||||
|
|
||||||
// get full path of specified directory entry
|
// get full path of specified directory entry
|
||||||
void WinEntry::get_path(PTSTR path)
|
void WinEntry::get_path(PTSTR path) const
|
||||||
{
|
{
|
||||||
int level = 0;
|
int level = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
for(Entry* entry=this; entry; level++) {
|
for(const Entry* entry=this; entry; level++) {
|
||||||
LPCTSTR name = entry->_data.cFileName;
|
LPCTSTR name = entry->_data.cFileName;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct WinEntry : public Entry
|
||||||
protected:
|
protected:
|
||||||
WinEntry() : Entry(ET_WINDOWS) {}
|
WinEntry() : Entry(ET_WINDOWS) {}
|
||||||
|
|
||||||
virtual void get_path(PTSTR path);
|
virtual void get_path(PTSTR path) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WinDirectory : public WinEntry, public Directory
|
struct WinDirectory : public WinEntry, public Directory
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
//
|
//
|
||||||
// startmenu.cpp
|
// startmenu.cpp
|
||||||
//
|
//
|
||||||
|
// Explorer start menu
|
||||||
|
//
|
||||||
// Martin Fuchs, 19.08.2003
|
// Martin Fuchs, 19.08.2003
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -30,6 +32,7 @@
|
||||||
|
|
||||||
#include "../explorer.h"
|
#include "../explorer.h"
|
||||||
#include "../globals.h"
|
#include "../globals.h"
|
||||||
|
#include "../externals.h"
|
||||||
#include "../explorer_intres.h"
|
#include "../explorer_intres.h"
|
||||||
|
|
||||||
#include "taskbar.h"
|
#include "taskbar.h"
|
||||||
|
@ -49,6 +52,8 @@ StartMenu::StartMenu(HWND hwnd, const StartMenuFolders& info)
|
||||||
{
|
{
|
||||||
for(StartMenuFolders::const_iterator it=info.begin(); it!=info.end(); ++it)
|
for(StartMenuFolders::const_iterator it=info.begin(); it!=info.end(); ++it)
|
||||||
_dirs.push_back(ShellDirectory(Desktop(), *it, _hwnd));
|
_dirs.push_back(ShellDirectory(Desktop(), *it, _hwnd));
|
||||||
|
|
||||||
|
_next_id = IDC_FIRST_MENU;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,21 +93,22 @@ LRESULT StartMenu::Init(LPCREATESTRUCT pcs)
|
||||||
void StartMenu::AddShellEntries(const ShellDirectory& dir, bool subfolders)
|
void StartMenu::AddShellEntries(const ShellDirectory& dir, bool subfolders)
|
||||||
{
|
{
|
||||||
for(const Entry*entry=dir._down; entry; entry=entry->_next) {
|
for(const Entry*entry=dir._down; entry; entry=entry->_next) {
|
||||||
|
// hide files like "desktop.ini"
|
||||||
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
|
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
HICON hIcon = entry->_hicon;
|
// hide subfolders if requested
|
||||||
|
|
||||||
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
|
||||||
if (!subfolders)
|
if (!subfolders)
|
||||||
|
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
hIcon = SmallIcon(IDI_EXPLORER);
|
const ShellEntry* shell_entry = static_cast<const ShellEntry*>(entry);
|
||||||
|
|
||||||
|
AddButton(dir._folder, shell_entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddButton(dir._folder.get_name(&*static_cast<const ShellEntry*>(entry)->_pidl).c_str(), hIcon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT StartMenu::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
LRESULT StartMenu::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
|
@ -112,9 +118,8 @@ LRESULT StartMenu::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
|
|
||||||
if (res>=HTSIZEFIRST && res<=HTSIZELAST)
|
if (res>=HTSIZEFIRST && res<=HTSIZELAST)
|
||||||
return HTCLIENT; // disable window resizing
|
return HTCLIENT; // disable window resizing
|
||||||
else
|
|
||||||
return res;
|
return res;}
|
||||||
}
|
|
||||||
|
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
if ((wparam&0xFFF0) == SC_SIZE)
|
if ((wparam&0xFFF0) == SC_SIZE)
|
||||||
|
@ -135,14 +140,21 @@ int StartMenu::Command(int id, int code)
|
||||||
DestroyWindow(_hwnd);
|
DestroyWindow(_hwnd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default: {
|
||||||
return super::Command(id, code);
|
ShellEntryMap::const_iterator found = _entry_map.find(id);
|
||||||
|
|
||||||
|
if (found != _entry_map.end()) {
|
||||||
|
ActivateEntry(const_cast<ShellEntry*>(found->second));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super::Command(id, code);}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartMenu::AddButton(LPCTSTR text, HICON hIcon, UINT id)
|
UINT StartMenu::AddButton(LPCTSTR text, HICON hIcon, UINT id)
|
||||||
{
|
{
|
||||||
if (id == (UINT)-1)
|
if (id == (UINT)-1)
|
||||||
id = ++_next_id;
|
id = ++_next_id;
|
||||||
|
@ -159,6 +171,38 @@ void StartMenu::AddButton(LPCTSTR text, HICON hIcon, UINT id)
|
||||||
MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
|
MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
|
||||||
|
|
||||||
StartMenuButton(_hwnd, rect.bottom-rect.top-STARTMENU_LINE_HEIGHT-4, text, id, hIcon);
|
StartMenuButton(_hwnd, rect.bottom-rect.top-STARTMENU_LINE_HEIGHT-4, text, id, hIcon);
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT StartMenu::AddButton(const ShellFolder folder, const ShellEntry* entry)
|
||||||
|
{
|
||||||
|
HICON hIcon = entry->_hicon;
|
||||||
|
|
||||||
|
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
|
hIcon = SmallIcon(IDI_EXPLORER);
|
||||||
|
|
||||||
|
const String& entry_name = folder.get_name(entry->_pidl);
|
||||||
|
|
||||||
|
UINT id = AddButton(entry_name, hIcon);
|
||||||
|
|
||||||
|
_entry_map[id] = entry;
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartMenu::ActivateEntry(ShellEntry* entry)
|
||||||
|
{
|
||||||
|
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
|
StartMenuFolders new_folders;
|
||||||
|
|
||||||
|
new_folders.push_back(entry->create_absolute_pidl(_hwnd));
|
||||||
|
|
||||||
|
WindowRect my_pos(_hwnd);
|
||||||
|
StartMenu::Create(my_pos.right, my_pos.top+STARTMENU_HEIGHT-4, new_folders, _hwnd);
|
||||||
|
} else {
|
||||||
|
entry->launch_entry(_hwnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -190,7 +234,7 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
|
||||||
AddShellEntries(usr_startmenu, false);
|
AddShellEntries(usr_startmenu, false);
|
||||||
|
|
||||||
// insert hard coded start entries
|
// insert hard coded start entries
|
||||||
//AddButton(ResString(IDS_PROGRAMS),0, IDC_PROGRAMS);
|
AddButton(ResString(IDS_PROGRAMS), 0, IDC_PROGRAMS);
|
||||||
AddButton(ResString(IDS_EXPLORE), SmallIcon(IDI_EXPLORER), IDC_EXPLORE);
|
AddButton(ResString(IDS_EXPLORE), SmallIcon(IDI_EXPLORER), IDC_EXPLORE);
|
||||||
AddButton(ResString(IDS_FAVORITES), 0, IDC_FAVORITES);
|
AddButton(ResString(IDS_FAVORITES), 0, IDC_FAVORITES);
|
||||||
AddButton(ResString(IDS_DOCUMENTS), 0, IDC_DOCUMENTS);
|
AddButton(ResString(IDS_DOCUMENTS), 0, IDC_DOCUMENTS);
|
||||||
|
@ -201,8 +245,13 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
|
||||||
AddButton(ResString(IDS_SHUTDOWN), SmallIcon(IDI_LOGOFF), IDC_SHUTDOWN);
|
AddButton(ResString(IDS_SHUTDOWN), SmallIcon(IDI_LOGOFF), IDC_SHUTDOWN);
|
||||||
AddButton(ResString(IDS_LOGOFF), SmallIcon(IDI_LOGOFF), IDC_LOGOFF);
|
AddButton(ResString(IDS_LOGOFF), SmallIcon(IDI_LOGOFF), IDC_LOGOFF);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//TEST: open programs menu folder
|
int StartMenuRoot::Command(int id, int code)
|
||||||
|
{
|
||||||
|
switch(id) {
|
||||||
|
case IDC_PROGRAMS: {
|
||||||
StartMenuFolders prg_folders;
|
StartMenuFolders prg_folders;
|
||||||
|
|
||||||
prg_folders.push_back(SpecialFolder(CSIDL_COMMON_PROGRAMS, _hwnd));
|
prg_folders.push_back(SpecialFolder(CSIDL_COMMON_PROGRAMS, _hwnd));
|
||||||
|
@ -210,14 +259,12 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
|
||||||
|
|
||||||
WindowRect my_pos(_hwnd);
|
WindowRect my_pos(_hwnd);
|
||||||
StartMenu::Create(my_pos.right, my_pos.top+STARTMENU_HEIGHT-4, prg_folders, _hwnd);
|
StartMenu::Create(my_pos.right, my_pos.top+STARTMENU_HEIGHT-4, prg_folders, _hwnd);
|
||||||
|
break;}
|
||||||
|
|
||||||
|
case IDC_EXPLORE:
|
||||||
|
explorer_show_frame(_hwnd, SW_SHOWNORMAL);
|
||||||
|
break;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int StartMenuRoot::Command(int id, int code)
|
|
||||||
{
|
|
||||||
switch(id) {
|
|
||||||
case IDC_LOGOFF:
|
case IDC_LOGOFF:
|
||||||
DestroyWindow(GetParent(_hwnd)); //TODO: show dialog and ask for acknowledge
|
DestroyWindow(GetParent(_hwnd)); //TODO: show dialog and ask for acknowledge
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -49,6 +49,8 @@ struct StartMenuButton : public Button
|
||||||
|
|
||||||
typedef list<ShellPath> StartMenuFolders;
|
typedef list<ShellPath> StartMenuFolders;
|
||||||
typedef list<ShellDirectory> StartMenuShellDirs;
|
typedef list<ShellDirectory> StartMenuShellDirs;
|
||||||
|
typedef map<UINT, const ShellEntry*> ShellEntryMap;
|
||||||
|
|
||||||
|
|
||||||
// Startmenu window
|
// Startmenu window
|
||||||
struct StartMenu : public OwnerDrawParent<Dialog>
|
struct StartMenu : public OwnerDrawParent<Dialog>
|
||||||
|
@ -64,6 +66,7 @@ struct StartMenu : public OwnerDrawParent<Dialog>
|
||||||
protected:
|
protected:
|
||||||
int _next_id;
|
int _next_id;
|
||||||
StartMenuShellDirs _dirs;
|
StartMenuShellDirs _dirs;
|
||||||
|
ShellEntryMap _entry_map;
|
||||||
|
|
||||||
static BtnWindowClass s_wcStartMenu;
|
static BtnWindowClass s_wcStartMenu;
|
||||||
|
|
||||||
|
@ -71,8 +74,12 @@ protected:
|
||||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||||
int Command(int id, int code);
|
int Command(int id, int code);
|
||||||
|
|
||||||
void AddButton(LPCTSTR text, HICON hIcon=0, UINT id=(UINT)-1);
|
UINT AddButton(LPCTSTR text, HICON hIcon=0, UINT id=(UINT)-1);
|
||||||
|
UINT AddButton(const ShellFolder folder, const ShellEntry* entry);
|
||||||
|
|
||||||
void AddShellEntries(const ShellDirectory& dir, bool subfolders=true);
|
void AddShellEntries(const ShellDirectory& dir, bool subfolders=true);
|
||||||
|
|
||||||
|
void ActivateEntry(ShellEntry* entry);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ DesktopBar::DesktopBar(HWND hwnd)
|
||||||
: super(hwnd)
|
: super(hwnd)
|
||||||
{
|
{
|
||||||
_hwndTaskBar = 0;
|
_hwndTaskBar = 0;
|
||||||
|
_startMenuRoot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DesktopBar::~DesktopBar()
|
DesktopBar::~DesktopBar()
|
||||||
|
@ -143,12 +144,18 @@ LRESULT DesktopBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
int DesktopBar::Command(int id, int code)
|
int DesktopBar::Command(int id, int code)
|
||||||
{
|
{
|
||||||
switch(id) {
|
switch(id) {
|
||||||
case IDC_START: {
|
case IDC_START:
|
||||||
|
if (_startMenuRoot && IsWindow(_startMenuRoot)) {
|
||||||
|
// dispose Startmenu
|
||||||
|
DestroyWindow(_startMenuRoot);
|
||||||
|
_startMenuRoot = 0;
|
||||||
|
} else {
|
||||||
// create Startmenu
|
// create Startmenu
|
||||||
WindowRect my_pos(_hwnd);
|
WindowRect my_pos(_hwnd);
|
||||||
|
|
||||||
StartMenuRoot::Create(my_pos.left, my_pos.top-4, _hwnd);
|
_startMenuRoot = StartMenuRoot::Create(my_pos.left, my_pos.top-4, _hwnd);
|
||||||
break;}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -77,6 +77,7 @@ protected:
|
||||||
int Command(int id, int code);
|
int Command(int id, int code);
|
||||||
|
|
||||||
HWND _hwndTaskBar;
|
HWND _hwndTaskBar;
|
||||||
|
HWND _startMenuRoot;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ CommonDesktop::~CommonDesktop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT path_from_pidlA(IShellFolder* folder, LPITEMIDLIST pidl, LPSTR buffer, int len)
|
HRESULT path_from_pidlA(IShellFolder* folder, LPCITEMIDLIST pidl, LPSTR buffer, int len)
|
||||||
{
|
{
|
||||||
StrRetA str;
|
StrRetA str;
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ HRESULT path_from_pidlA(IShellFolder* folder, LPITEMIDLIST pidl, LPSTR buffer, i
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT path_from_pidlW(IShellFolder* folder, LPITEMIDLIST pidl, LPWSTR buffer, int len)
|
HRESULT path_from_pidlW(IShellFolder* folder, LPCITEMIDLIST pidl, LPWSTR buffer, int len)
|
||||||
{
|
{
|
||||||
StrRetW str;
|
StrRetW str;
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ HRESULT path_from_pidlW(IShellFolder* folder, LPITEMIDLIST pidl, LPWSTR buffer,
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT name_from_pidl(IShellFolder* folder, LPITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags)
|
HRESULT name_from_pidl(IShellFolder* folder, LPCITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags)
|
||||||
{
|
{
|
||||||
StrRet str;
|
StrRet str;
|
||||||
|
|
||||||
|
@ -132,6 +132,7 @@ ShellFolder::ShellFolder()
|
||||||
ShellFolder::ShellFolder(IShellFolder* p)
|
ShellFolder::ShellFolder(IShellFolder* p)
|
||||||
: IShellFolderPtr(p)
|
: IShellFolderPtr(p)
|
||||||
{
|
{
|
||||||
|
p->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellFolder::ShellFolder(IShellFolder* parent, LPCITEMIDLIST pidl)
|
ShellFolder::ShellFolder(IShellFolder* parent, LPCITEMIDLIST pidl)
|
||||||
|
@ -179,16 +180,24 @@ void ShellFolder::attach(IShellFolder* parent, LPCITEMIDLIST pidl)
|
||||||
ShellFolder::ShellFolder()
|
ShellFolder::ShellFolder()
|
||||||
{
|
{
|
||||||
CheckError(SHGetDesktopFolder(&_p));
|
CheckError(SHGetDesktopFolder(&_p));
|
||||||
|
|
||||||
|
_p->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellFolder::ShellFolder(IShellFolder* p)
|
ShellFolder::ShellFolder(IShellFolder* p)
|
||||||
: SIfacePtr<IShellFolder>(p)
|
: SIfacePtr<IShellFolder>(p)
|
||||||
{
|
{
|
||||||
|
_p->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellFolder::ShellFolder(IShellFolder* parent, LPCITEMIDLIST pidl)
|
ShellFolder::ShellFolder(IShellFolder* parent, LPCITEMIDLIST pidl)
|
||||||
{
|
{
|
||||||
|
if (pidl->mkid.cb)
|
||||||
CheckError(parent->BindToObject(pidl, 0, IID_IShellFolder, (LPVOID*)&_p));
|
CheckError(parent->BindToObject(pidl, 0, IID_IShellFolder, (LPVOID*)&_p));
|
||||||
|
else
|
||||||
|
_p = Desktop();
|
||||||
|
|
||||||
|
_p->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellFolder::ShellFolder(LPCITEMIDLIST pidl)
|
ShellFolder::ShellFolder(LPCITEMIDLIST pidl)
|
||||||
|
@ -197,6 +206,8 @@ ShellFolder::ShellFolder(LPCITEMIDLIST pidl)
|
||||||
CheckError(Desktop()->BindToObject(pidl, 0, IID_IShellFolder, (LPVOID*)&_p));
|
CheckError(Desktop()->BindToObject(pidl, 0, IID_IShellFolder, (LPVOID*)&_p));
|
||||||
else
|
else
|
||||||
_p = Desktop();
|
_p = Desktop();
|
||||||
|
|
||||||
|
_p->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellFolder::attach(IShellFolder* parent, LPCITEMIDLIST pidl)
|
void ShellFolder::attach(IShellFolder* parent, LPCITEMIDLIST pidl)
|
||||||
|
@ -205,6 +216,7 @@ void ShellFolder::attach(IShellFolder* parent, LPCITEMIDLIST pidl)
|
||||||
|
|
||||||
CheckError(parent->BindToObject(pidl, 0, IID_IShellFolder, (LPVOID*)&_p));
|
CheckError(parent->BindToObject(pidl, 0, IID_IShellFolder, (LPVOID*)&_p));
|
||||||
|
|
||||||
|
_p->AddRef();
|
||||||
h->Release();
|
h->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
|
||||||
#ifndef _INC_COMUTIL // is comutil.h of MS headers available?
|
#ifndef _INC_COMUTIL // is comutil.h of MS headers available?
|
||||||
|
#ifndef _NO_COMUTIL
|
||||||
#define _NO_COMUTIL
|
#define _NO_COMUTIL
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -393,9 +395,9 @@ extern ShellFolder& Desktop();
|
||||||
#define path_from_pidl path_from_pidlA
|
#define path_from_pidl path_from_pidlA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern HRESULT path_from_pidlA(IShellFolder* folder, LPITEMIDLIST pidl, LPSTR buffer, int len);
|
extern HRESULT path_from_pidlA(IShellFolder* folder, LPCITEMIDLIST pidl, LPSTR buffer, int len);
|
||||||
extern HRESULT path_from_pidlW(IShellFolder* folder, LPITEMIDLIST pidl, LPWSTR buffer, int len);
|
extern HRESULT path_from_pidlW(IShellFolder* folder, LPCITEMIDLIST pidl, LPWSTR buffer, int len);
|
||||||
extern HRESULT name_from_pidl(IShellFolder* folder, LPITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags);
|
extern HRESULT name_from_pidl(IShellFolder* folder, LPCITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags);
|
||||||
|
|
||||||
|
|
||||||
// wrapper class for item ID lists
|
// wrapper class for item ID lists
|
||||||
|
@ -578,7 +580,7 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
|
||||||
|
|
||||||
|
|
||||||
// convert an item id list from relative to absolute (=relative to the desktop) format
|
// convert an item id list from relative to absolute (=relative to the desktop) format
|
||||||
LPITEMIDLIST create_absolute_pidl(IShellFolder* parent_folder, HWND hwnd)
|
LPITEMIDLIST create_absolute_pidl(IShellFolder* parent_folder, HWND hwnd) const
|
||||||
{
|
{
|
||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,10 @@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable: 4786) // disable warnings about too long debug information symbols
|
||||||
|
#endif
|
||||||
|
|
||||||
// STL headers for strings and streams
|
// STL headers for strings and streams
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -64,7 +68,7 @@ using namespace std;
|
||||||
#include <comdef.h>
|
#include <comdef.h>
|
||||||
using namespace _com_util;
|
using namespace _com_util;
|
||||||
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER && !_NO_COMUTIL
|
||||||
|
|
||||||
|
|
||||||
#define for if (0) {} else for
|
#define for if (0) {} else for
|
||||||
|
|
|
@ -440,6 +440,7 @@ int Window::MessageLoop()
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
while(GetMessage(&msg, 0, 0, 0)) {
|
while(GetMessage(&msg, 0, 0, 0)) {
|
||||||
|
try {
|
||||||
if (pretranslate_msg(&msg))
|
if (pretranslate_msg(&msg))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -453,6 +454,9 @@ int Window::MessageLoop()
|
||||||
} catch(COMException& e) {
|
} catch(COMException& e) {
|
||||||
HandleException(e, g_Globals._hMainWnd);
|
HandleException(e, g_Globals._hMainWnd);
|
||||||
}
|
}
|
||||||
|
} catch(COMException& e) {
|
||||||
|
HandleException(e, g_Globals._hMainWnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg.wParam;
|
return msg.wParam;
|
||||||
|
|
Loading…
Reference in a new issue