diff --git a/progmgr/group.c b/progmgr/group.c index 6773f28..a7d3b37 100644 --- a/progmgr/group.c +++ b/progmgr/group.c @@ -15,4 +15,52 @@ // #define WIN32_LEAN_AND_MEAN #include -/* Functions */ \ No newline at end of file +/* Functions */ + +/* * * *\ + GroupWndProc - + Group window procedure. + RETURNS - + Zero if nothing, otherwise returns the good stuff. +\* * * */ +LRESULT CALLBACK GroupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + { + break; + } + default: +GrpProcDefault: + return DefMDIChildProc(hWnd, message, wParam, lParam); + } + return 0; +} + +/* * * *\ + TempCreateGroup - + th + RETURNS - + handle to window +\* * * */ +HWND TempCreateGroup(HWND hMDIClient) +{ + MDICREATESTRUCT mcs; + HWND hChild; + + mcs.szTitle = L"[Untitled]"; + mcs.szClass = szGrpClass; + mcs.hOwner = GetModuleHandle(NULL); + mcs.x = mcs.cx = CW_USEDEFAULT; + mcs.y = mcs.cy = CW_USEDEFAULT; + mcs.style = MDIS_ALLCHILDSTYLES; + + hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LONG)&mcs); + if (!hChild) + { + MessageBox(hMDIClient, L"MDI Child creation failed.", L"Oh Oh...", + MB_ICONEXCLAMATION | MB_OK); + } + return hChild; +} \ No newline at end of file diff --git a/progmgr/group.h b/progmgr/group.h index 2e6524e..412994d 100644 --- a/progmgr/group.h +++ b/progmgr/group.h @@ -13,3 +13,6 @@ /* Includes */ #include +/* Function Prototypes */ +LRESULT CALLBACK GroupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +HWND TempCreateGroup(HWND hMDIClient); \ No newline at end of file diff --git a/progmgr/lang/res_en-US.rc b/progmgr/lang/res_en-US.rc index 380e8b5..62824ac 100644 Binary files a/progmgr/lang/res_en-US.rc and b/progmgr/lang/res_en-US.rc differ diff --git a/progmgr/progmgr.c b/progmgr/progmgr.c index 78fa1f8..07b2632 100644 --- a/progmgr/progmgr.c +++ b/progmgr/progmgr.c @@ -9,6 +9,7 @@ /* Headers */ #include "progmgr.h" +#include "group.h" #include "resource.h" #include "registry.h" // #define WIN32_LEAN_AND_MEAN @@ -18,15 +19,18 @@ /* Variables */ // Global BOOL bIsDefaultShell = FALSE; +// Window Related +HICON hProgMgrIcon = NULL; +HICON hGroupIcon = NULL; +HINSTANCE hAppInstance; +HWND hWndProgMgr = NULL; +HWND hWndMDIClient = NULL; // Global Strings WCHAR szAppTitle[32]; WCHAR szProgMgr[] = L"progmgr"; WCHAR szWebsite[64]; -// Window Related -HICON hProgMgrIcon = NULL; -HINSTANCE hAppInstance; -HWND hWndProgMgr = NULL; -HWND hWndMDIClient = NULL; +WCHAR szClass[16]; +WCHAR szGrpClass[16]; /* Functions */ @@ -41,8 +45,8 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, HMENU hMenu; HMENU hSystemMenu; WNDCLASS wc = { 0 }; + WNDCLASSEX wce = { 0 }; WCHAR szBuffer[MAX_PATH]; - WCHAR szClass[16]; RECT rcRoot; POINT ptOffset; @@ -50,24 +54,41 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, // Create Strings LoadString(hAppInstance, IDS_PMCLASS, szClass, ARRAYSIZE(szClass)); + LoadString(hAppInstance, IDS_GRPCLASS, szGrpClass, ARRAYSIZE(szGrpClass)); LoadString(hAppInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle)); LoadString(hAppInstance, IDS_WEBSITE, szWebsite, ARRAYSIZE(szWebsite)); // Get Desktop background color //CreateSolidBrush(GetBackgroundColor - // Register the Frame Window + // Register the Frame Window Class wc.lpfnWndProc = WndProc; wc.hInstance = hAppInstance; wc.hIcon = hProgMgrIcon = LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_PROGMGR), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED); wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND); + // wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND); + wc.hbrBackground = NULL; wc.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN); wc.lpszClassName = szClass; if (!RegisterClass(&wc)) return FALSE; + // Register the Group Window Class + wce.cbSize = sizeof(WNDCLASSEX); + wce.lpfnWndProc = GroupWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wce.hInstance = hAppInstance; + wce.hIcon = hGroupIcon = LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_PROGMGR), IMAGE_ICON, + 0, 0, LR_DEFAULTSIZE | LR_SHARED); + wce.hCursor = LoadCursor(NULL, IDC_ARROW); + wce.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); + wce.lpszMenuName = NULL; + wce.lpszClassName = szGrpClass; + if (!RegisterClassEx(&wce)) + return FALSE; + // Load the Accelerator table hAccel = LoadAccelerators(hAppInstance, MAKEINTRESOURCE(IDA_ACCELS)); if (!hAccel) diff --git a/progmgr/progmgr.h b/progmgr/progmgr.h index e71f9de..5abeb47 100644 --- a/progmgr/progmgr.h +++ b/progmgr/progmgr.h @@ -32,12 +32,15 @@ // PROGMGR.C extern BOOL bIsDefaultShell; extern HICON hProgMgrIcon; +extern HICON hGroupIcon; extern HINSTANCE hAppInstance; extern HWND hWndProgMgr; extern HWND hWndMDIClient; extern WCHAR szAppTitle[32]; extern WCHAR szProgMgr[]; extern WCHAR szWebsite[64]; +extern WCHAR szClass[16]; +extern WCHAR szGrpClass[16]; /* Function Prototypes */ // DESKTOP.C diff --git a/progmgr/resource.h b/progmgr/resource.h index 022e869..0751d60 100644 Binary files a/progmgr/resource.h and b/progmgr/resource.h differ diff --git a/progmgr/wndproc.c b/progmgr/wndproc.c index 1e807e7..d0e5c0b 100644 --- a/progmgr/wndproc.c +++ b/progmgr/wndproc.c @@ -9,6 +9,7 @@ /* Headers */ #include "progmgr.h" +#include "group.h" #include "resource.h" #include "registry.h" // #define WIN32_LEAN_AND_MEAN @@ -30,78 +31,76 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { - - case WM_CREATE: - { - RECT rc; - CLIENTCREATESTRUCT ccs; - - // Frame Window - hWndProgMgr = hWnd; - - // MDI Client Window - ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), IDM_WINDOW); - ccs.idFirstChild = IDM_WINDOW_CHILDSTART; - - GetClientRect(hWndProgMgr, &rc); - - hWndMDIClient = CreateWindow(L"MDIClient", NULL, - WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL, - // rc.left - 1, rc.top - 1, rc.right + 2, rc.bottom + 2, - 0, 0, 0, 0, - hWnd, (HMENU)1, hAppInstance, (LPWSTR)&ccs); - - if (!hWndMDIClient) { - return -1; - } - break; - } - - case WM_SYSCOMMAND: - { - if (wParam == IDM_TASKMGR) + case WM_CREATE: { - ShellExecute(hWndProgMgr, L"open", L"TASKMGR.EXE", NULL, NULL, SW_NORMAL); + CLIENTCREATESTRUCT ccs; + RECT rc; + + // Frame Window + hWndProgMgr = hWnd; + + // MDI Client Window + ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), IDM_WINDOW); + ccs.idFirstChild = IDM_WINDOW_CHILDSTART; + + GetClientRect(hWndProgMgr, &rc); + + if (!(hWndMDIClient = CreateWindowEx(WS_EX_COMPOSITED, L"MDIClient", + NULL, WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE, + // rc.left - 1, rc.top - 1, rc.right + 2, rc.bottom + 2, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + hWnd, (HMENU)1, hAppInstance, (LPWSTR)&ccs))) + { + return FALSE; + } + + //TempCreateGroup(hWndMDIClient); + break; } - if (wParam == IDM_SHUTDOWN) - if (wParam == IDM_FILE_EXIT) - if (wParam == IDM_FILE_RUN) + case WM_SYSCOMMAND: { - CmdProc(hWnd, wParam, lParam); - break; + if (wParam == IDM_TASKMGR) + { + ShellExecute(hWndProgMgr, L"open", L"TASKMGR.EXE", NULL, NULL, SW_NORMAL); + break; + } + if (wParam == IDM_SHUTDOWN) + if (wParam == IDM_FILE_EXIT) + if (wParam == IDM_FILE_RUN) + { + CmdProc(hWnd, wParam, lParam); + break; + } + + goto WndProcDefault; } - goto WndProcDefault; - //return DefFrameProc(hWnd, hwndMDIClient, uiMsg, wParam, lParam); - } + case WM_COMMAND: + if (CmdProc(hWnd, wParam, lParam)) + break; - case WM_COMMAND: - if (CmdProc(hWnd, wParam, lParam)) - { + goto WndProcDefault; + + case WM_CLOSE: + if (bSaveSettings) + SaveConfig(TRUE, TRUE, TRUE); + + if (bIsDefaultShell && (GetShellWindow() != NULL)) + SetShellWindow(0); + + PostQuitMessage(0); break; - } - goto WndProcDefault; - case WM_CLOSE: - if (bSaveSettings) - SaveConfig(TRUE, TRUE, TRUE); + case WM_ENDSESSION: + PostQuitMessage(0); + break; - if (bIsDefaultShell && (GetShellWindow() != NULL)) - SetShellWindow(0); - - PostQuitMessage(0); - break; - - case WM_ENDSESSION: - PostQuitMessage(0); - break; - - default: + default: WndProcDefault: - return DefFrameProc(hWnd, hWndMDIClient, message, wParam, lParam); - } + return DefFrameProc(hWnd, hWndMDIClient, message, wParam, lParam); + } return 0; }