- use Winefile command line for initial directory selection

- remove useless hwndParent variable

svn path=/trunk/; revision=19286
This commit is contained in:
Martin Fuchs 2005-11-16 23:07:37 +00:00
parent 3984ae405d
commit f451b823d8
3 changed files with 25 additions and 17 deletions

View file

@ -25,7 +25,7 @@ endif
ifeq ($(UNICODE),1) ifeq ($(UNICODE),1)
CFLAGS += -DUNICODE CFLAGS += -DUNICODE
# LFLAGS+= -Wl,--entry,_wWinMain@16 #LFLAGS += -Wl,--entry,_wWinMain@16
RCFLAGS += -DUNICODE RCFLAGS += -DUNICODE
endif endif

View file

@ -2146,9 +2146,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
break; break;
case WM_DESTROY: case WM_DESTROY:
/* don't exit desktop when closing file manager window */ PostQuitMessage(0);
if (!Globals.hwndParent)
PostQuitMessage(0);
break; break;
case WM_INITMENUPOPUP: { case WM_INITMENUPOPUP: {
@ -4683,11 +4681,11 @@ static void InitInstance(HINSTANCE hinstance)
} }
static void show_frame(HWND hwndParent, int cmdshow) static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
{ {
const static TCHAR sMDICLIENT[] = {'M','D','I','C','L','I','E','N','T','\0'}; const static TCHAR sMDICLIENT[] = {'M','D','I','C','L','I','E','N','T','\0'};
TCHAR path[MAX_PATH], b1[BUFFER_LEN]; TCHAR buffer[MAX_PATH], b1[BUFFER_LEN];
ChildWnd* child; ChildWnd* child;
HMENU hMenuFrame, hMenuWindow; HMENU hMenuFrame, hMenuWindow;
@ -4696,8 +4694,6 @@ static void show_frame(HWND hwndParent, int cmdshow)
if (Globals.hMainWnd) if (Globals.hMainWnd)
return; return;
Globals.hwndParent = hwndParent;
hMenuFrame = LoadMenu(Globals.hInstance, MAKEINTRESOURCE(IDM_WINEFILE)); hMenuFrame = LoadMenu(Globals.hInstance, MAKEINTRESOURCE(IDM_WINEFILE));
hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2); hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2);
@ -4752,7 +4748,11 @@ static void show_frame(HWND hwndParent, int cmdshow)
Globals.hMainWnd, (HMENU)IDW_STATUSBAR, hinstance, 0);*/ Globals.hMainWnd, (HMENU)IDW_STATUSBAR, hinstance, 0);*/
/*TODO: read paths and window placements from registry */ /*TODO: read paths and window placements from registry */
GetCurrentDirectory(MAX_PATH, path);
if (!path || !*path) {
GetCurrentDirectory(MAX_PATH, buffer);
path = buffer;
}
ShowWindow(Globals.hMainWnd, cmdshow); ShowWindow(Globals.hMainWnd, cmdshow);
@ -4826,7 +4826,7 @@ static int find_window_class(LPCTSTR classname)
#endif #endif
static int winefile_main(HINSTANCE hinstance, HWND hwndParent, int cmdshow) static int winefile_main(HINSTANCE hinstance, int cmdshow, LPCTSTR path)
{ {
MSG msg; MSG msg;
@ -4836,7 +4836,7 @@ static int winefile_main(HINSTANCE hinstance, HWND hwndParent, int cmdshow)
/*TODO: read window placement from registry */ /*TODO: read window placement from registry */
cmdshow = SW_MAXIMIZE; cmdshow = SW_MAXIMIZE;
show_frame(hwndParent, cmdshow); show_frame(0, cmdshow, path);
while(GetMessage(&msg, 0, 0, 0)) { while(GetMessage(&msg, 0, 0, 0)) {
if (Globals.hmdiclient && TranslateMDISysAccel(Globals.hmdiclient, &msg)) if (Globals.hmdiclient && TranslateMDISysAccel(Globals.hmdiclient, &msg))
@ -4855,17 +4855,26 @@ static int winefile_main(HINSTANCE hinstance, HWND hwndParent, int cmdshow)
} }
int APIENTRY WinMain(HINSTANCE hinstance, #if defined(UNICODE) && defined(_MSC_VER)
HINSTANCE previnstance, int APIENTRY wWinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPWSTR cmdline, int cmdshow)
LPSTR cmdline, #else
int cmdshow) int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPSTR cmdline, int cmdshow)
#endif
{ {
#ifdef _NO_EXTENSIONS #ifdef _NO_EXTENSIONS
if (find_window_class(sWINEFILEFRAME)) if (find_window_class(sWINEFILEFRAME))
return 1; return 1;
#endif #endif
winefile_main(hinstance, 0, cmdshow); #if defined(UNICODE) && !defined(_MSC_VER)
{ /* convert ANSI cmdline into WCS path string */
TCHAR buffer[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, cmdline, -1, buffer, MAX_PATH);
winefile_main(hinstance, cmdshow, buffer);
}
#else
winefile_main(hinstance, cmdshow, cmdline);
#endif
return 0; return 0;
} }

View file

@ -118,7 +118,6 @@ typedef struct
HANDLE hInstance; HANDLE hInstance;
HACCEL haccel; HACCEL haccel;
ATOM hframeClass; ATOM hframeClass;
HWND hwndParent;
HWND hMainWnd; HWND hMainWnd;
HMENU hMenuFrame; HMENU hMenuFrame;