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

@@ -16,3 +16,51 @@
#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,11 +31,10 @@ 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; CLIENTCREATESTRUCT ccs;
RECT rc;
// Frame Window // Frame Window
hWndProgMgr = hWnd; hWndProgMgr = hWnd;
@@ -45,15 +45,17 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
GetClientRect(hWndProgMgr, &rc); GetClientRect(hWndProgMgr, &rc);
hWndMDIClient = CreateWindow(L"MDIClient", NULL, if (!(hWndMDIClient = CreateWindowEx(WS_EX_COMPOSITED, L"MDIClient",
WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL, NULL, WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,
// rc.left - 1, rc.top - 1, rc.right + 2, rc.bottom + 2, // rc.left - 1, rc.top - 1, rc.right + 2, rc.bottom + 2,
0, 0, 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hWnd, (HMENU)1, hAppInstance, (LPWSTR)&ccs); hWnd, (HMENU)1, hAppInstance, (LPWSTR)&ccs)))
{
if (!hWndMDIClient) { return FALSE;
return -1;
} }
//TempCreateGroup(hWndMDIClient);
break; break;
} }
@@ -64,7 +66,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
ShellExecute(hWndProgMgr, L"open", L"TASKMGR.EXE", NULL, NULL, SW_NORMAL); ShellExecute(hWndProgMgr, L"open", L"TASKMGR.EXE", NULL, NULL, SW_NORMAL);
break; break;
} }
if (wParam == IDM_SHUTDOWN) if (wParam == IDM_SHUTDOWN)
if (wParam == IDM_FILE_EXIT) if (wParam == IDM_FILE_EXIT)
if (wParam == IDM_FILE_RUN) if (wParam == IDM_FILE_RUN)
@@ -74,14 +75,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
goto WndProcDefault; goto WndProcDefault;
//return DefFrameProc(hWnd, hwndMDIClient, uiMsg, wParam, lParam);
} }
case WM_COMMAND: case WM_COMMAND:
if (CmdProc(hWnd, wParam, lParam)) if (CmdProc(hWnd, wParam, lParam))
{
break; break;
}
goto WndProcDefault; goto WndProcDefault;
case WM_CLOSE: case WM_CLOSE: