From c1bd24b5d5dffac0b9102f2bedd4df19c44773b9 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sun, 28 Dec 2003 23:11:46 +0000 Subject: [PATCH] process one command line parameter to open cabinet window svn path=/trunk/; revision=7302 --- reactos/subsys/system/explorer/explorer.cpp | 21 +++++++++++++++------ reactos/subsys/system/explorer/externals.h | 4 ++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/reactos/subsys/system/explorer/explorer.cpp b/reactos/subsys/system/explorer/explorer.cpp index 7c0ae3c2659..7589f4cd0b2 100644 --- a/reactos/subsys/system/explorer/explorer.cpp +++ b/reactos/subsys/system/explorer/explorer.cpp @@ -120,7 +120,7 @@ ResBitmap::ResBitmap(UINT nid) } -void explorer_show_frame(HWND hwndDesktop, int cmdshow) +void explorer_show_frame(HWND hwndDesktop, int cmdshow, LPTSTR lpCmdLine) { if (g_Globals._hMainWnd) return; @@ -136,8 +136,11 @@ void explorer_show_frame(HWND hwndDesktop, int cmdshow) ShowWindow(hMainFrame, cmdshow); UpdateWindow(hMainFrame); - // Open the first child window after initializing the whole application - PostMessage(hMainFrame, PM_OPEN_WINDOW, OWM_EXPLORE|OWM_DETAILS, 0); + // Open the first child window after initializing the application + if (lpCmdLine) + PostMessage(hMainFrame, PM_OPEN_WINDOW, 0, (LPARAM)lpCmdLine); + else + PostMessage(hMainFrame, PM_OPEN_WINDOW, OWM_EXPLORE|OWM_DETAILS, 0); } } @@ -161,7 +164,7 @@ static void InitInstance(HINSTANCE hInstance) } -int explorer_main(HINSTANCE hInstance, HWND hwndDesktop, int cmdshow) +int explorer_main(HINSTANCE hInstance, HWND hwndDesktop, LPTSTR lpCmdLine, int cmdshow) { CONTEXT("explorer_main"); @@ -188,7 +191,7 @@ int explorer_main(HINSTANCE hInstance, HWND hwndDesktop, int cmdshow) cmdshow = SW_MAXIMIZE; */ - explorer_show_frame(hwndDesktop, cmdshow); + explorer_show_frame(hwndDesktop, cmdshow, lpCmdLine); } return Window::MessageLoop(); @@ -300,7 +303,13 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL } } - int ret = explorer_main(hInstance, hwndDesktop, nShowCmd); + /**TODO fix command line handling */ + if (*lpCmdLine=='"' && lpCmdLine[_tcslen(lpCmdLine)-1]=='"') { + ++lpCmdLine; + lpCmdLine[_tcslen(lpCmdLine)-1] = '\0'; + } + + int ret = explorer_main(hInstance, hwndDesktop, lpCmdLine, nShowCmd); return ret; } diff --git a/reactos/subsys/system/explorer/externals.h b/reactos/subsys/system/explorer/externals.h index d2882ef9793..81ca8d70b86 100644 --- a/reactos/subsys/system/explorer/externals.h +++ b/reactos/subsys/system/explorer/externals.h @@ -35,10 +35,10 @@ extern "C" { extern int startup(int argc, char *argv[]); // explorer main routine -extern int explorer_main(HINSTANCE hinstance, HWND hwndDesktop, int cmdshow); +extern int explorer_main(HINSTANCE hinstance, HWND hwndDesktop, LPTSTR lpCmdLine, int cmdshow); // display explorer/file manager window -extern void explorer_show_frame(HWND hwndDesktop, int cmdshow); +extern void explorer_show_frame(HWND hwndDesktop, int cmdshow, LPTSTR lpCmdLine=NULL); // test for already running desktop instance extern BOOL IsAnyDesktopRunning();