From a374276f97f74fe2747e53324f002acb259d5ef5 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sat, 16 Aug 2003 12:06:52 +0000 Subject: [PATCH] additional comments svn path=/trunk/; revision=5601 --- .../system/explorer/desktop/desktop.cpp | 11 +++++++- reactos/subsys/system/explorer/explorer.cpp | 23 +++++++++++------ reactos/subsys/system/explorer/externals.h | 2 +- .../system/explorer/shell/shellbrowser.cpp | 25 ++++++++++++------- .../subsys/system/explorer/taskbar/ex_bar.c | 6 ++--- .../subsys/system/explorer/winefile/desktop.c | 2 +- 6 files changed, 46 insertions(+), 23 deletions(-) diff --git a/reactos/subsys/system/explorer/desktop/desktop.cpp b/reactos/subsys/system/explorer/desktop/desktop.cpp index b773ffe0c5f..8936e37e188 100644 --- a/reactos/subsys/system/explorer/desktop/desktop.cpp +++ b/reactos/subsys/system/explorer/desktop/desktop.cpp @@ -136,7 +136,16 @@ LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) case WM_CREATE: { HRESULT hr = Desktop()->CreateViewObject(_hwnd, IID_IShellView, (void**)&_pShellView); +/* also possible: + SFV_CREATE sfv_create; + sfv_create.cbSize = sizeof(SFV_CREATE); + sfv_create.pshf = Desktop(); + sfv_create.psvOuter = NULL; + sfv_create.psfvcb = NULL; + + HRESULT hr = SHCreateShellFolderView(&sfv_create, &_pShellView); +*/ HWND hWndView = 0; if (SUCCEEDED(hr)) { @@ -150,7 +159,7 @@ LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) hr = _pShellView->CreateViewWindow(NULL, &fs, this, &rect, &hWndView); - //TODO: use IShellBrowser::GetViewStateStream() to restore previous view state + //TODO: use IShellBrowser::GetViewStateStream() to restore previous view state -> see SHOpenRegStream() if (SUCCEEDED(hr)) { _pShellView->UIActivate(SVUIA_ACTIVATE_FOCUS); diff --git a/reactos/subsys/system/explorer/explorer.cpp b/reactos/subsys/system/explorer/explorer.cpp index 41e8996d7bb..1d2ef8e8cf3 100644 --- a/reactos/subsys/system/explorer/explorer.cpp +++ b/reactos/subsys/system/explorer/explorer.cpp @@ -146,16 +146,18 @@ int explorer_main(HINSTANCE hinstance, HWND hwndParent, int cmdshow) InitInstance(hinstance); -#ifndef _ROS_ // don't maximize if being called from the ROS desktop - if (cmdshow == SW_SHOWNORMAL) - /*TODO: read window placement from registry */ - cmdshow = SW_MAXIMIZE; -#endif - if (hwndParent) g_Globals._desktop_mode = true; - explorer_show_frame(hwndParent, cmdshow); + if (cmdshow != SW_HIDE) { +#ifndef _ROS_ // don't maximize if being called from the ROS desktop + if (cmdshow == SW_SHOWNORMAL) + /*TODO: read window placement from registry */ + cmdshow = SW_MAXIMIZE; +#endif + + explorer_show_frame(hwndParent, cmdshow); + } while(GetMessage(&msg, 0, 0, 0)) { if (g_Globals._hMainWnd && SendMessage(g_Globals._hMainWnd, WM_TRANSLATE_MSG, 0, (LPARAM)&msg)) @@ -190,6 +192,11 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL if (!lstrcmp(lpCmdLine,TEXT("-desktop"))) startup_desktop = TRUE; + if (!lstrcmp(lpCmdLine,TEXT("-noexplorer"))) { + nShowCmd = SW_HIDE; + startup_desktop = TRUE; + } + HWND hwndDesktop = 0; if (startup_desktop) @@ -197,7 +204,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL hwndDesktop = create_desktop_window(hInstance); // Initialize the explorer bar - HWND hwndExplorerBar = InitializeExplorerBar(hInstance, nShowCmd); + HWND hwndExplorerBar = InitializeExplorerBar(hInstance); // Load plugins LoadAvailablePlugIns(hwndExplorerBar); diff --git a/reactos/subsys/system/explorer/externals.h b/reactos/subsys/system/explorer/externals.h index e12171f896b..6a3fe29afae 100644 --- a/reactos/subsys/system/explorer/externals.h +++ b/reactos/subsys/system/explorer/externals.h @@ -47,7 +47,7 @@ extern HWND create_desktop_window(HINSTANCE hInstance); extern BOOL IsAnyDesktopRunning(); // start desktop bar -extern HWND InitializeExplorerBar(HINSTANCE hInstance, int nCmdShow); +extern HWND InitializeExplorerBar(HINSTANCE hInstance); // load plugins extern int LoadAvailablePlugIns(HWND ExplWnd); diff --git a/reactos/subsys/system/explorer/shell/shellbrowser.cpp b/reactos/subsys/system/explorer/shell/shellbrowser.cpp index 6ab4d8e1ef0..cb5a1cd7bbf 100644 --- a/reactos/subsys/system/explorer/shell/shellbrowser.cpp +++ b/reactos/subsys/system/explorer/shell/shellbrowser.cpp @@ -193,20 +193,27 @@ void ShellBrowserChild::Tree_DoItemMenu(HWND hwndTreeView, HTREEITEM hItem, LPPO HWND hwndParent = ::GetParent(hwndTreeView); Entry* entry = (Entry*)itemData; - IShellFolder* folder; + IShellFolder* shell_folder; + ShellDirectory* dir; - if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - folder = static_cast(entry)->_folder; - else - folder = entry->_up? static_cast(entry->_up)->_folder: Desktop(); + if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + dir = static_cast(entry); + shell_folder = dir->_folder; + } else { + dir = static_cast(entry->_up); + shell_folder = dir? dir->_folder: Desktop(); + } - folder->AddRef(); + shell_folder->AddRef(); - if (folder) { + if (shell_folder) { LPCITEMIDLIST pidl = static_cast(entry)->_pidl; IContextMenu* pcm; - HRESULT hr = folder->GetUIObjectOf(hwndParent, 1, &pidl, IID_IContextMenu, NULL, (LPVOID*)&pcm); + + HRESULT hr = CDefFolderMenu_Create2(dir?dir->_pidl:DesktopFolder(), hwndParent, 1, &pidl, shell_folder, NULL, 0, NULL, &pcm); + +// HRESULT hr = shell_folder->GetUIObjectOf(hwndParent, 1, &pidl, IID_IContextMenu, NULL, (LPVOID*)&pcm); if (SUCCEEDED(hr)) { HMENU hPopup = CreatePopupMenu(); @@ -251,7 +258,7 @@ void ShellBrowserChild::Tree_DoItemMenu(HWND hwndTreeView, HTREEITEM hItem, LPPO pcm->Release(); } - folder->Release(); + shell_folder->Release(); } } } diff --git a/reactos/subsys/system/explorer/taskbar/ex_bar.c b/reactos/subsys/system/explorer/taskbar/ex_bar.c index f185a81c8fa..2f82d6906e5 100644 --- a/reactos/subsys/system/explorer/taskbar/ex_bar.c +++ b/reactos/subsys/system/explorer/taskbar/ex_bar.c @@ -64,7 +64,7 @@ DWORD LoadProperty(int PInt) } // Initialize and create the Explorer Panel -HWND InitializeExplorerBar(HINSTANCE hInstance, int nCmdShow) +HWND InitializeExplorerBar(HINSTANCE hInstance) { HWND ExplorerBar; WNDCLASS ExplorerBarClass; @@ -99,7 +99,7 @@ HWND InitializeExplorerBar(HINSTANCE hInstance, int nCmdShow) ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons"); - ShowWindow(ExplorerBar, nCmdShow); // Show the bar + ShowWindow(ExplorerBar, SW_SHOW); // Show the bar return ExplorerBar; } @@ -338,7 +338,7 @@ int WINAPI WinMain(HINSTANCE hInstance, // Initializing the Explorer Bar ! // - if (!(ExplHnd=InitializeExplorerBar(hInstance, nCmdShow))) + if (!(ExplHnd=InitializeExplorerBar(hInstance))) { fprintf(stderr,"FATAL : Explorer bar could not be initialized properly ! Exiting !\n"); return 1; diff --git a/reactos/subsys/system/explorer/winefile/desktop.c b/reactos/subsys/system/explorer/winefile/desktop.c index f977731d081..003391b36e4 100644 --- a/reactos/subsys/system/explorer/winefile/desktop.c +++ b/reactos/subsys/system/explorer/winefile/desktop.c @@ -190,7 +190,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL #endif // Initializing the Explorer Bar - if (!(hwndExplorerBar=InitializeExplorerBar(hInstance, nShowCmd))) + if (!(hwndExplorerBar=InitializeExplorerBar(hInstance))) { fprintf(stderr,"FATAL: Explorer bar could not be initialized properly ! Exiting !\n"); return 1;