mirror of
https://github.com/reactos/reactos.git
synced 2025-07-05 19:11:26 +00:00
Added patch by Martain Fuchs for mulitple explorer instances.
svn path=/trunk/; revision=5122
This commit is contained in:
parent
3364b9cc5f
commit
8434cb67a9
5 changed files with 107 additions and 81 deletions
|
@ -75,68 +75,72 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int Width, Height;
|
int Width, Height;
|
||||||
WNDCLASSEX wc;
|
WNDCLASSEX wc;
|
||||||
HWND Desktop;
|
HWND hwndDesktop = 0;
|
||||||
|
|
||||||
STARTUPINFO startupinfo;
|
STARTUPINFO startupinfo;
|
||||||
int nCmdShow = SW_SHOWNORMAL;
|
int nCmdShow = SW_SHOWNORMAL;
|
||||||
|
|
||||||
HINSTANCE hInstance = GetModuleHandle(NULL);
|
HINSTANCE hInstance = GetModuleHandle(NULL);
|
||||||
HWND hwndExplorerBar;
|
|
||||||
|
|
||||||
wc.cbSize = sizeof(WNDCLASSEX);
|
// create desktop window and task var only, if we are the first explorer instance
|
||||||
wc.style = CS_DBLCLKS;
|
if (!find_window_class(DesktopClassName))
|
||||||
wc.lpfnWndProc = &DeskWndProc;
|
|
||||||
wc.cbClsExtra = 0;
|
|
||||||
wc.cbWndExtra = 0;
|
|
||||||
wc.hInstance = hInstance;
|
|
||||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
|
||||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
|
||||||
wc.hbrBackground= (HBRUSH) GetStockObject(BLACK_BRUSH);
|
|
||||||
wc.lpszMenuName = NULL;
|
|
||||||
wc.lpszClassName= DesktopClassName;
|
|
||||||
wc.hIconSm = NULL;
|
|
||||||
|
|
||||||
if (!RegisterClassEx(&wc))
|
|
||||||
return 1; // error
|
|
||||||
|
|
||||||
|
|
||||||
Width = GetSystemMetrics(SM_CXSCREEN);
|
|
||||||
Height = GetSystemMetrics(SM_CYSCREEN);
|
|
||||||
|
|
||||||
Desktop = CreateWindowEx(0, DesktopClassName, TEXT("Desktop"),
|
|
||||||
WS_VISIBLE | WS_POPUP | WS_CLIPCHILDREN,
|
|
||||||
0, 0, Width, Height,
|
|
||||||
NULL, NULL, hInstance, NULL);
|
|
||||||
|
|
||||||
if (! Desktop)
|
|
||||||
{
|
{
|
||||||
fprintf(stderr,"FATAL: Desktop window could not be initialized properly - Exiting.\n");
|
HWND hwndExplorerBar;
|
||||||
return 1; // error
|
|
||||||
}
|
|
||||||
|
|
||||||
// call winefile startup routine
|
wc.cbSize = sizeof(WNDCLASSEX);
|
||||||
startupinfo.wShowWindow = SW_SHOWNORMAL;
|
wc.style = CS_DBLCLKS;
|
||||||
GetStartupInfo(&startupinfo);
|
wc.lpfnWndProc = &DeskWndProc;
|
||||||
|
wc.cbClsExtra = 0;
|
||||||
|
wc.cbWndExtra = 0;
|
||||||
|
wc.hInstance = hInstance;
|
||||||
|
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||||
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
|
wc.hbrBackground= (HBRUSH) GetStockObject(BLACK_BRUSH);
|
||||||
|
wc.lpszMenuName = NULL;
|
||||||
|
wc.lpszClassName= DesktopClassName;
|
||||||
|
wc.hIconSm = NULL;
|
||||||
|
|
||||||
if (startupinfo.dwFlags & STARTF_USESHOWWINDOW)
|
if (!RegisterClassEx(&wc))
|
||||||
nCmdShow = startupinfo.wShowWindow;
|
return 1; // error
|
||||||
|
|
||||||
// Initializing the Explorer Bar !
|
|
||||||
if (!(hwndExplorerBar=InitializeExplorerBar(hInstance, nCmdShow)))
|
|
||||||
{
|
|
||||||
fprintf(stderr,"FATAL: Explorer bar could not be initialized properly ! Exiting !\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load plugins
|
Width = GetSystemMetrics(SM_CXSCREEN);
|
||||||
if (!ExplorerLoadPlugins(hwndExplorerBar))
|
Height = GetSystemMetrics(SM_CYSCREEN);
|
||||||
{
|
|
||||||
fprintf(stderr,"WARNING: No plugin for desktop bar could be loaded.\n");
|
hwndDesktop = CreateWindowEx(0, DesktopClassName, TEXT("Desktop"),
|
||||||
}
|
WS_VISIBLE | WS_POPUP | WS_CLIPCHILDREN,
|
||||||
|
0, 0, Width, Height,
|
||||||
|
NULL, NULL, hInstance, NULL);
|
||||||
|
|
||||||
|
if (!hwndDesktop)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"FATAL: Desktop window could not be initialized properly - Exiting.\n");
|
||||||
|
return 1; // error
|
||||||
|
}
|
||||||
|
|
||||||
|
// call winefile startup routine
|
||||||
|
GetStartupInfo(&startupinfo);
|
||||||
|
|
||||||
|
if (startupinfo.dwFlags & STARTF_USESHOWWINDOW)
|
||||||
|
nCmdShow = startupinfo.wShowWindow;
|
||||||
|
|
||||||
|
// Initializing the Explorer Bar
|
||||||
|
if (!(hwndExplorerBar=InitializeExplorerBar(hInstance, nCmdShow)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"FATAL: Explorer bar could not be initialized properly ! Exiting !\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load plugins
|
||||||
|
if (!ExplorerLoadPlugins(hwndExplorerBar))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"WARNING: No plugin for desktop bar could be loaded.\n");
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef _DEBUG //MF: disabled for debugging
|
#ifndef _DEBUG //MF: disabled for debugging
|
||||||
startup(argc, argv); // invoke the startup groups
|
startup(argc, argv); // invoke the startup groups
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return winefile_main(hInstance, Desktop, nCmdShow);
|
return winefile_main(hInstance, hwndDesktop, nCmdShow);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ SOURCE=.\De.rc
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\drivebar.bmp
|
SOURCE=.\res\drivebar.bmp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
@ -230,6 +230,14 @@ SOURCE=.\En.rc
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\res\images.bmp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\include\resource.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\resource.rc
|
SOURCE=.\resource.rc
|
||||||
|
|
||||||
!IF "$(CFG)" == "explorer - Win32 Release"
|
!IF "$(CFG)" == "explorer - Win32 Release"
|
||||||
|
@ -259,13 +267,33 @@ SOURCE=.\resource.rc
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\winefile.ico
|
SOURCE=.\res\toolbar.bmp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\res\winefile.ico
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\winefile.rc
|
SOURCE=.\winefile.rc
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
|
# Begin Group "include"
|
||||||
|
|
||||||
|
# PROP Default_Filter ""
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\include\explorer.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\include\license.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\include\winefile.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\desktop.c
|
SOURCE=.\desktop.c
|
||||||
|
@ -276,18 +304,6 @@ SOURCE=.\ex_bar.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\explorer.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\license.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\resource.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\splitpath.c
|
SOURCE=.\splitpath.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -298,9 +314,5 @@ SOURCE=.\startup.c
|
||||||
|
|
||||||
SOURCE=.\winefile.c
|
SOURCE=.\winefile.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\winefile.h
|
|
||||||
# End Source File
|
|
||||||
# End Target
|
# End Target
|
||||||
# End Project
|
# End Project
|
||||||
|
|
|
@ -5,6 +5,9 @@ extern int startup( int argc, char *argv[] );
|
||||||
// winefile main routine
|
// winefile main routine
|
||||||
extern int winefile_main(HINSTANCE hinstance, HWND hwndParent, int cmdshow);
|
extern int winefile_main(HINSTANCE hinstance, HWND hwndParent, int cmdshow);
|
||||||
|
|
||||||
|
// search for windows of a specific clasname
|
||||||
|
extern int find_window_class(LPCTSTR classname);
|
||||||
|
|
||||||
// display file manager window
|
// display file manager window
|
||||||
extern void ShowFileMgr(HWND hWndParent, int cmdshow);
|
extern void ShowFileMgr(HWND hWndParent, int cmdshow);
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,7 @@ typedef struct
|
||||||
HANDLE hInstance;
|
HANDLE hInstance;
|
||||||
HACCEL haccel;
|
HACCEL haccel;
|
||||||
ATOM hframeClass;
|
ATOM hframeClass;
|
||||||
|
HWND hwndParent;
|
||||||
|
|
||||||
HWND hMainWnd;
|
HWND hMainWnd;
|
||||||
HMENU hMenuFrame;
|
HMENU hMenuFrame;
|
||||||
|
|
|
@ -51,8 +51,8 @@
|
||||||
|
|
||||||
WINEFILE_GLOBALS Globals;
|
WINEFILE_GLOBALS Globals;
|
||||||
|
|
||||||
extern void WineLicense(HWND hWnd);
|
extern void WineLicense(HWND hwnd);
|
||||||
extern void WineWarranty(HWND hWnd);
|
extern void WineWarranty(HWND hwnd);
|
||||||
|
|
||||||
typedef struct _Entry {
|
typedef struct _Entry {
|
||||||
struct _Entry* next;
|
struct _Entry* next;
|
||||||
|
@ -1068,9 +1068,9 @@ LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
#ifndef _ROS_ // dont't exit desktop when closing file manager window
|
// dont't exit desktop when closing file manager window
|
||||||
PostQuitMessage(0);
|
if (!Globals.hwndParent)
|
||||||
#endif
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_COMMAND: {
|
case WM_COMMAND: {
|
||||||
|
@ -2820,7 +2820,7 @@ static void InitInstance(HINSTANCE hinstance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ShowFileMgr(HWND hWndParent, int cmdshow)
|
void ShowFileMgr(HWND hwndParent, int cmdshow)
|
||||||
{
|
{
|
||||||
TCHAR path[MAX_PATH];
|
TCHAR path[MAX_PATH];
|
||||||
ChildWnd* child;
|
ChildWnd* child;
|
||||||
|
@ -2831,6 +2831,8 @@ void ShowFileMgr(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);
|
||||||
|
|
||||||
|
@ -2845,7 +2847,7 @@ void ShowFileMgr(HWND hWndParent, int cmdshow)
|
||||||
/* create main window */
|
/* create main window */
|
||||||
Globals.hMainWnd = CreateWindowEx(0, (LPCTSTR)(int)Globals.hframeClass, _T("Wine File"), WS_OVERLAPPEDWINDOW,
|
Globals.hMainWnd = CreateWindowEx(0, (LPCTSTR)(int)Globals.hframeClass, _T("Wine File"), WS_OVERLAPPEDWINDOW,
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
hWndParent, Globals.hMenuFrame, Globals.hInstance, 0/*lpParam*/);
|
hwndParent, Globals.hMenuFrame, Globals.hInstance, 0/*lpParam*/);
|
||||||
|
|
||||||
|
|
||||||
Globals.hmdiclient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
|
Globals.hmdiclient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
|
||||||
|
@ -2960,8 +2962,6 @@ void ExitInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _NO_EXTENSIONS
|
|
||||||
|
|
||||||
/* search for already running win[e]files */
|
/* search for already running win[e]files */
|
||||||
|
|
||||||
static int g_foundPrevInstance = 0;
|
static int g_foundPrevInstance = 0;
|
||||||
|
@ -2980,7 +2980,16 @@ static BOOL CALLBACK EnumWndProc(HWND hwnd, LPARAM lparam)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
int find_window_class(LPCTSTR classname)
|
||||||
|
{
|
||||||
|
/* allow only one running instance */
|
||||||
|
EnumWindows(EnumWndProc, (LPARAM)classname);
|
||||||
|
|
||||||
|
if (g_foundPrevInstance)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int winefile_main(HINSTANCE hinstance, HWND hwndParent, int cmdshow)
|
int winefile_main(HINSTANCE hinstance, HWND hwndParent, int cmdshow)
|
||||||
|
@ -3022,10 +3031,7 @@ int APIENTRY WinMain(HINSTANCE hinstance,
|
||||||
int cmdshow)
|
int cmdshow)
|
||||||
{
|
{
|
||||||
#ifdef _NO_EXTENSIONS
|
#ifdef _NO_EXTENSIONS
|
||||||
/* allow only one running instance */
|
if (find_window_class(WINEFILEFRAME))
|
||||||
EnumWindows(EnumWndProc, (LPARAM)WINEFILEFRAME);
|
|
||||||
|
|
||||||
if (g_foundPrevInstance)
|
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue