so much... mdi stuff.. AND IT'S STILL NOT OVER

This commit is contained in:
freedom
2023-08-02 00:59:58 -06:00
parent 8ab85cecf0
commit 1206264a68
7 changed files with 143 additions and 69 deletions

View File

@@ -15,4 +15,52 @@
// #define WIN32_LEAN_AND_MEAN // #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
/* Functions */ /* 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;
}

View File

@@ -13,3 +13,6 @@
/* Includes */ /* Includes */
#include <wtypes.h> #include <wtypes.h>
/* Function Prototypes */
LRESULT CALLBACK GroupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
HWND TempCreateGroup(HWND hMDIClient);

Binary file not shown.

View File

@@ -9,6 +9,7 @@
/* Headers */ /* Headers */
#include "progmgr.h" #include "progmgr.h"
#include "group.h"
#include "resource.h" #include "resource.h"
#include "registry.h" #include "registry.h"
// #define WIN32_LEAN_AND_MEAN // #define WIN32_LEAN_AND_MEAN
@@ -18,15 +19,18 @@
/* Variables */ /* Variables */
// Global // Global
BOOL bIsDefaultShell = FALSE; BOOL bIsDefaultShell = FALSE;
// Window Related
HICON hProgMgrIcon = NULL;
HICON hGroupIcon = NULL;
HINSTANCE hAppInstance;
HWND hWndProgMgr = NULL;
HWND hWndMDIClient = NULL;
// Global Strings // Global Strings
WCHAR szAppTitle[32]; WCHAR szAppTitle[32];
WCHAR szProgMgr[] = L"progmgr"; WCHAR szProgMgr[] = L"progmgr";
WCHAR szWebsite[64]; WCHAR szWebsite[64];
// Window Related WCHAR szClass[16];
HICON hProgMgrIcon = NULL; WCHAR szGrpClass[16];
HINSTANCE hAppInstance;
HWND hWndProgMgr = NULL;
HWND hWndMDIClient = NULL;
/* Functions */ /* Functions */
@@ -41,8 +45,8 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
HMENU hMenu; HMENU hMenu;
HMENU hSystemMenu; HMENU hSystemMenu;
WNDCLASS wc = { 0 }; WNDCLASS wc = { 0 };
WNDCLASSEX wce = { 0 };
WCHAR szBuffer[MAX_PATH]; WCHAR szBuffer[MAX_PATH];
WCHAR szClass[16];
RECT rcRoot; RECT rcRoot;
POINT ptOffset; POINT ptOffset;
@@ -50,24 +54,41 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
// Create Strings // Create Strings
LoadString(hAppInstance, IDS_PMCLASS, szClass, ARRAYSIZE(szClass)); LoadString(hAppInstance, IDS_PMCLASS, szClass, ARRAYSIZE(szClass));
LoadString(hAppInstance, IDS_GRPCLASS, szGrpClass, ARRAYSIZE(szGrpClass));
LoadString(hAppInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle)); LoadString(hAppInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle));
LoadString(hAppInstance, IDS_WEBSITE, szWebsite, ARRAYSIZE(szWebsite)); LoadString(hAppInstance, IDS_WEBSITE, szWebsite, ARRAYSIZE(szWebsite));
// Get Desktop background color // Get Desktop background color
//CreateSolidBrush(GetBackgroundColor //CreateSolidBrush(GetBackgroundColor
// Register the Frame Window // Register the Frame Window Class
wc.lpfnWndProc = WndProc; wc.lpfnWndProc = WndProc;
wc.hInstance = hAppInstance; wc.hInstance = hAppInstance;
wc.hIcon = hProgMgrIcon = LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_PROGMGR), IMAGE_ICON, wc.hIcon = hProgMgrIcon = LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_PROGMGR), IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED); 0, 0, LR_DEFAULTSIZE | LR_SHARED);
wc.hCursor = LoadCursor(NULL, IDC_ARROW); 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.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN);
wc.lpszClassName = szClass; wc.lpszClassName = szClass;
if (!RegisterClass(&wc)) if (!RegisterClass(&wc))
return FALSE; 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 // Load the Accelerator table
hAccel = LoadAccelerators(hAppInstance, MAKEINTRESOURCE(IDA_ACCELS)); hAccel = LoadAccelerators(hAppInstance, MAKEINTRESOURCE(IDA_ACCELS));
if (!hAccel) if (!hAccel)

View File

@@ -32,12 +32,15 @@
// PROGMGR.C // PROGMGR.C
extern BOOL bIsDefaultShell; extern BOOL bIsDefaultShell;
extern HICON hProgMgrIcon; extern HICON hProgMgrIcon;
extern HICON hGroupIcon;
extern HINSTANCE hAppInstance; extern HINSTANCE hAppInstance;
extern HWND hWndProgMgr; extern HWND hWndProgMgr;
extern HWND hWndMDIClient; extern HWND hWndMDIClient;
extern WCHAR szAppTitle[32]; extern WCHAR szAppTitle[32];
extern WCHAR szProgMgr[]; extern WCHAR szProgMgr[];
extern WCHAR szWebsite[64]; extern WCHAR szWebsite[64];
extern WCHAR szClass[16];
extern WCHAR szGrpClass[16];
/* Function Prototypes */ /* Function Prototypes */
// DESKTOP.C // DESKTOP.C

Binary file not shown.

View File

@@ -9,6 +9,7 @@
/* Headers */ /* Headers */
#include "progmgr.h" #include "progmgr.h"
#include "group.h"
#include "resource.h" #include "resource.h"
#include "registry.h" #include "registry.h"
// #define WIN32_LEAN_AND_MEAN // #define WIN32_LEAN_AND_MEAN
@@ -30,78 +31,76 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (message) switch (message)
{ {
case WM_CREATE:
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)
{ {
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; break;
} }
if (wParam == IDM_SHUTDOWN) case WM_SYSCOMMAND:
if (wParam == IDM_FILE_EXIT)
if (wParam == IDM_FILE_RUN)
{ {
CmdProc(hWnd, wParam, lParam); if (wParam == IDM_TASKMGR)
break; {
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; case WM_COMMAND:
//return DefFrameProc(hWnd, hwndMDIClient, uiMsg, wParam, lParam); if (CmdProc(hWnd, wParam, lParam))
} break;
case WM_COMMAND: goto WndProcDefault;
if (CmdProc(hWnd, wParam, lParam))
{ case WM_CLOSE:
if (bSaveSettings)
SaveConfig(TRUE, TRUE, TRUE);
if (bIsDefaultShell && (GetShellWindow() != NULL))
SetShellWindow(0);
PostQuitMessage(0);
break; break;
}
goto WndProcDefault;
case WM_CLOSE: case WM_ENDSESSION:
if (bSaveSettings) PostQuitMessage(0);
SaveConfig(TRUE, TRUE, TRUE); break;
if (bIsDefaultShell && (GetShellWindow() != NULL)) default:
SetShellWindow(0);
PostQuitMessage(0);
break;
case WM_ENDSESSION:
PostQuitMessage(0);
break;
default:
WndProcDefault: WndProcDefault:
return DefFrameProc(hWnd, hWndMDIClient, message, wParam, lParam); return DefFrameProc(hWnd, hWndMDIClient, message, wParam, lParam);
} }
return 0; return 0;
} }