sync minor mod.

svn path=/trunk/; revision=3224
This commit is contained in:
Robert Dickenson 2002-07-14 22:38:37 +00:00
parent 17731321a4
commit 1713f73a79
2 changed files with 63 additions and 76 deletions

View file

@ -41,21 +41,19 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Global Variables: // Globals and Variables:
// //
BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
static HHOOK hcbthook;
static ChildWnd* newchild = NULL;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Local module support methods // Local module support methods
// //
//////////////////////////////////////////////////////////////////////////////// static LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
static HHOOK hcbthook;
static ChildWnd* newchild = NULL;
LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
{ {
if (code == HCBT_CREATEWND && newchild) { if (code == HCBT_CREATEWND && newchild) {
ChildWnd* pChildWnd = newchild; ChildWnd* pChildWnd = newchild;
@ -102,7 +100,8 @@ static HWND InitChildWindow(LPTSTR param)
} }
return 0; return 0;
} }
BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam)
static BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam)
{ {
if (!GetWindow(hWnd, GW_OWNER)) { if (!GetWindow(hWnd, GW_OWNER)) {
SendMessage(GetParent(hWnd), WM_MDIRESTORE, (WPARAM)hWnd, 0); SendMessage(GetParent(hWnd), WM_MDIRESTORE, (WPARAM)hWnd, 0);
@ -113,27 +112,18 @@ BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam)
return 1; return 1;
} }
//////////////////////////////////////////////////////////////////////////////// static LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
//
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes WM_COMMAND messages for the main frame window.
//
//
LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
HWND hChildWnd; HWND hChildWnd;
if (1) { switch (LOWORD(wParam)) {
switch (LOWORD(wParam)) { case ID_WINDOW_CLOSEALL:
case ID_WINDOW_CLOSEALL: EnumChildWindows(hMDIClient, &CloseEnumProc, 0);
EnumChildWindows(hMDIClient, &CloseEnumProc, 0); break;
break; case ID_WINDOW_CLOSE:
case ID_WINDOW_CLOSE: hChildWnd = (HWND) SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0);
hChildWnd = (HWND) SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0); if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0))
if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0)) SendMessage(hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0);
SendMessage(hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0); break;
break;
// case ID_FILE_EXIT: // case ID_FILE_EXIT:
// SendMessage(hWnd, WM_CLOSE, 0, 0); // SendMessage(hWnd, WM_CLOSE, 0, 0);
// break; // break;
@ -141,45 +131,44 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
// DestroyWindow(hWnd); // DestroyWindow(hWnd);
// break; // break;
// case ID_FILE_OPEN: // case ID_FILE_OPEN:
case ID_REGISTRY_PRINTERSETUP: case ID_REGISTRY_PRINTERSETUP:
//PRINTDLG pd; //PRINTDLG pd;
//PrintDlg(&pd); //PrintDlg(&pd);
//PAGESETUPDLG psd; //PAGESETUPDLG psd;
//PageSetupDlg(&psd); //PageSetupDlg(&psd);
break; break;
case ID_REGISTRY_OPENLOCAL: case ID_REGISTRY_OPENLOCAL:
case ID_WINDOW_NEW_WINDOW: case ID_WINDOW_NEW_WINDOW:
InitChildWindow("Child Window"); InitChildWindow("Child Window");
return 0; return 0;
case ID_WINDOW_CASCADE: case ID_WINDOW_CASCADE:
SendMessage(hMDIClient, WM_MDICASCADE, 0, 0); SendMessage(hMDIClient, WM_MDICASCADE, 0, 0);
break; break;
case ID_WINDOW_TILE_HORZ: case ID_WINDOW_TILE_HORZ:
SendMessage(hMDIClient, WM_MDITILE, MDITILE_HORIZONTAL, 0); SendMessage(hMDIClient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
break; break;
case ID_WINDOW_TILE_VERT: case ID_WINDOW_TILE_VERT:
SendMessage(hMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0); SendMessage(hMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0);
break; break;
case ID_WINDOW_ARRANGE_ICONS: case ID_WINDOW_ARRANGE_ICONS:
SendMessage(hMDIClient, WM_MDIICONARRANGE, 0, 0); SendMessage(hMDIClient, WM_MDIICONARRANGE, 0, 0);
break; break;
case ID_HELP_ABOUT: case ID_HELP_ABOUT:
// ShowAboutBox(hWnd); // ShowAboutBox(hWnd);
{ {
HICON hIcon = LoadIcon(hInst, (LPCTSTR)IDI_REGEDT32); HICON hIcon = LoadIcon(hInst, (LPCTSTR)IDI_REGEDT32);
ShellAbout(hWnd, szTitle, "FrameWndProc", hIcon); ShellAbout(hWnd, szTitle, "FrameWndProc", hIcon);
//if (hIcon) DestroyIcon(hIcon); // NOT REQUIRED //if (hIcon) DestroyIcon(hIcon); // NOT REQUIRED
}
break;
default:
hChildWnd = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0);
if (IsWindow(hChildWnd))
SendMessage(hChildWnd, WM_COMMAND, wParam, lParam);
else
return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam);
} }
break;
default:
hChildWnd = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0);
if (IsWindow(hChildWnd))
SendMessage(hChildWnd, WM_COMMAND, wParam, lParam);
else
return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam);
} }
return 0; return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -212,14 +201,14 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_DESTROY: case WM_DESTROY:
PostQuitMessage(0); PostQuitMessage(0);
break; break;
case WM_QUERYENDSESSION: case WM_QUERYENDSESSION:
case WM_CLOSE: case WM_CLOSE:
SendMessage(hWnd, WM_COMMAND, ID_WINDOW_CLOSEALL, 0); SendMessage(hWnd, WM_COMMAND, ID_WINDOW_CLOSEALL, 0);
if (GetWindow(hMDIClient, GW_CHILD) != NULL) if (GetWindow(hMDIClient, GW_CHILD) != NULL)
return 0; return 0;
// else fall thru... // else fall thru...
default: default:
return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam); return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam);
} }
return 0; return 0;
} }

View file

@ -247,7 +247,7 @@ HWND CreateChildWindow(int drv_id)
return 0; return 0;
} }
BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam) static BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam)
{ {
if (!GetWindow(hWnd, GW_OWNER)) { if (!GetWindow(hWnd, GW_OWNER)) {
SendMessage(GetParent(hWnd), WM_MDIRESTORE, (WPARAM)hWnd, 0); SendMessage(GetParent(hWnd), WM_MDIRESTORE, (WPARAM)hWnd, 0);
@ -258,7 +258,7 @@ BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam)
return 1; return 1;
} }
void OnEnterMenuLoop(HWND hWnd) static void OnEnterMenuLoop(HWND hWnd)
{ {
int nParts; int nParts;
@ -269,7 +269,7 @@ void OnEnterMenuLoop(HWND hWnd)
SendMessage(Globals.hStatusBar, SB_SETTEXT, (WPARAM)0, (LPARAM)_T("")); SendMessage(Globals.hStatusBar, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
} }
void OnExitMenuLoop(HWND hWnd) static void OnExitMenuLoop(HWND hWnd)
{ {
RECT rc; RECT rc;
int nParts[3]; int nParts[3];
@ -286,7 +286,7 @@ void OnExitMenuLoop(HWND hWnd)
UpdateStatusBar(); UpdateStatusBar();
} }
void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu) static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
{ {
TCHAR str[100]; TCHAR str[100];
@ -364,8 +364,6 @@ static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
resize_frame_client(hWnd); resize_frame_client(hWnd);
} }
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) // FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
@ -571,7 +569,7 @@ static TBBUTTON tbButtonNew[] = {
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
}; };
LRESULT MsgNotify(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam) static LRESULT MsgNotify(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{ {
LPNMHDR lpnmhdr; LPNMHDR lpnmhdr;