diff --git a/misc/pman64.png b/misc/pman64.png new file mode 100644 index 0000000..54ef564 Binary files /dev/null and b/misc/pman64.png differ diff --git a/progmgr/desktop.c b/progmgr/desktop.c new file mode 100644 index 0000000..28b46c9 --- /dev/null +++ b/progmgr/desktop.c @@ -0,0 +1,9 @@ +/* * * * * * * *\ + DESKTOP.C - + Copyright (c) 2023 freedom7341, Freedom Desktop + DESCRIPTION - + Program Manager's desktop window. + Only visible as the default shell. + LICENSE INFORMATION - + MIT License, see LICENSE.txt in the root folder +\* * * * * * * */ \ No newline at end of file diff --git a/progmgr/lang/res_en-US.rc b/progmgr/lang/res_en-US.rc index 3ce2278..7b689ca 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 c800a53..9781942 100644 --- a/progmgr/progmgr.c +++ b/progmgr/progmgr.c @@ -12,7 +12,11 @@ #include "resource.h" #include "registry.h" // #define WIN32_LEAN_AND_MEAN +#define SECURITY_WIN32 #include +#include +#include +#include /* Variables */ // Global @@ -24,15 +28,23 @@ WCHAR szWebsite[64]; // Window Related HICON hProgMgrIcon = NULL; HINSTANCE hAppInstance; -HWND hwndProgMgr = NULL; -HWND hwndMDIClient = NULL; +HWND hWndProgMgr = NULL; +HWND hWndMDIClient = NULL; -/* Program Entry Point */ +/* Functions */ +/* * * *\ + wWinMain - + Program Manager's entry point. +\* * * */ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) { MSG msg = { 0 }; + HANDLE hAccel; WNDCLASS wc = { 0 }; WCHAR szClass[16]; + WCHAR szUsername[UNLEN + 1] = L""; + DWORD dwUsernameLen = UNLEN; + WCHAR szWindowTitle[UNLEN + ARRAYSIZE(szAppTitle) + 4] = L""; hAppInstance = hInstance; @@ -48,29 +60,47 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine // Register the Frame Window wc.lpfnWndProc = WndProc; wc.hInstance = hAppInstance; - wc.hIcon = hProgMgrIcon = LoadImage(hAppInstance, MAKEINTRESOURCE(PROGMGRICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED); + 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.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN); wc.lpszClassName = szClass; if (!RegisterClass(&wc)) - return 1; + return FALSE; + + // Load the Accelerator table + hAccel = LoadAccelerators(hAppInstance, MAKEINTRESOURCE(IDA_ACCELS)); + if (!hAccel) + return FALSE; InitializeRegistryKeys(); //if (IsProgMgrDefaultShell) { //} + GetUserNameEx(NameSamCompatible, szUsername, &dwUsernameLen); + // OutputDebugString(szUsername); + + StringCchCopy(szWindowTitle, ARRAYSIZE(szAppTitle), szAppTitle); + StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), L" - "); + StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), szUsername); + if (!CreateWindow(wc.lpszClassName, - szAppTitle, + szWindowTitle, WS_OVERLAPPEDWINDOW | WS_VISIBLE, - 160, 80, 640, 480, 0, 0, hInstance, NULL)) + 160, 80, 640, 480, 0, 0, hAppInstance, NULL)) return 2; //hSystemMenu = GetSystemMenu(hwndProgman, FALSE); while (GetMessage(&msg, NULL, 0, 0) > 0) - DispatchMessage(&msg); + { + if (!TranslateMDISysAccel(hWndMDIClient, &msg) && + !TranslateAccelerator(hWndProgMgr, hAccel, &msg)) + { + DispatchMessage(&msg); + } + } return 0; } diff --git a/progmgr/progmgr.h b/progmgr/progmgr.h index 855680e..9f27f22 100644 --- a/progmgr/progmgr.h +++ b/progmgr/progmgr.h @@ -12,6 +12,7 @@ #pragma comment(linker,"\"/manifestdependency:type='win32' \ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") +#pragma comment(lib, "Secur32.lib") /* Includes */ #include @@ -33,9 +34,10 @@ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") /* Global Variables */ // PROGMGR.C extern BOOL bIsDefaultShell; +extern HICON hProgMgrIcon; extern HINSTANCE hAppInstance; -extern HWND hwndProgMgr; -extern HWND hwndMDIClient; +extern HWND hWndProgMgr; +extern HWND hWndMDIClient; extern WCHAR szAppTitle[32]; extern WCHAR szProgMgr[]; extern WCHAR szWebsite[64]; @@ -46,4 +48,4 @@ BOOL RunFile(HWND hWndOwner, HICON hIcon, LPWSTR lpszDir, LPWSTR lpszTitle, LPWS BOOL ShutdownDlg(HWND hWndOwner); // WNDPROC.C LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); -LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam); +LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam); \ No newline at end of file diff --git a/progmgr/progmgr.vcxproj b/progmgr/progmgr.vcxproj index 3a9056e..ce57623 100644 --- a/progmgr/progmgr.vcxproj +++ b/progmgr/progmgr.vcxproj @@ -156,6 +156,7 @@ + diff --git a/progmgr/resource.h b/progmgr/resource.h index 657cf34..55ff830 100644 Binary files a/progmgr/resource.h and b/progmgr/resource.h differ diff --git a/progmgr/resource.rc b/progmgr/resource.rc index d0f9606..2bb8675 100644 --- a/progmgr/resource.rc +++ b/progmgr/resource.rc @@ -19,7 +19,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang\res_en-US.rc" // English (US) /* Primary Icon Library */ -PROGMGRICON ICON PRELOAD icons\progmgr.ico +IDI_PROGMGR ICON PRELOAD icons\progmgr.ico +IDI_PROGGRP ICON icons\pmgroup.ico +IDI_PROGITM ICON icons\pmitem.ico /* Secondary Icon Library */ diff --git a/progmgr/wndproc.c b/progmgr/wndproc.c index ac3ff7b..5bd3d47 100644 --- a/progmgr/wndproc.c +++ b/progmgr/wndproc.c @@ -15,7 +15,6 @@ #include /* Functions */ - /* * * *\ WndProc - Program Manager's window procedure. @@ -24,7 +23,6 @@ \* * * */ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - switch (message) { case WM_CREATE: @@ -32,21 +30,22 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) RECT rc; CLIENTCREATESTRUCT ccs; - hwndProgMgr = hWnd; + // Frame Window + hWndProgMgr = hWnd; - // ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), IDM_WINDOW); - // ccs.idFirstChild = IDM_CHILDSTART; + // MDI Client Window + ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), IDM_WINDOW); + ccs.idFirstChild = IDM_WINDOW_CHILDSTART; - GetClientRect(hwndProgMgr, &rc); + GetClientRect(hWndProgMgr, &rc); - hwndMDIClient = CreateWindow(TEXT("MDIClient"), - NULL, - WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_BORDER, - rc.left - 1, rc.top - 1, - rc.right + 2, rc.bottom + 2, - hWnd, (HMENU)1, hAppInstance, - (LPTSTR)&ccs); - if (!hwndMDIClient) { + 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; @@ -83,7 +82,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) default: WndProcDefault: - return DefWindowProc(hWnd, message, wParam, lParam); + return DefFrameProc(hWnd, hWndMDIClient, message, wParam, lParam); } return 0; @@ -114,11 +113,10 @@ LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam) case IDM_HELP_ABOUT: { WCHAR szTitle[40]; - OutputDebugString(L"ABOUT BALLS!"); - HICON hIcon = LoadIcon(hAppInstance, MAKEINTRESOURCE(PROGMGRICON)); + // OutputDebugString(L"ABOUT BALLS!"); LoadString(hAppInstance, IDS_APPTITLE, szTitle, CharSizeOf(szTitle)); - ShellAbout(hwndProgMgr, szTitle, NULL, hIcon); + ShellAbout(hWndProgMgr, szTitle, NULL, hProgMgrIcon); break; } @@ -127,4 +125,15 @@ LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam) } return TRUE; +} + +/* * * *\ + ChildWndProc - + Program Manager's window procedure. + RETURNS - + Zero if nothing, otherwise returns the good stuff. +\* * * */ +LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + return FALSE; } \ No newline at end of file