tons of stuff here, most importantly now displays the username in the titlebar like old progman

This commit is contained in:
freedom
2023-07-20 01:27:45 -06:00
parent 2b21acce36
commit 78410609a9
9 changed files with 83 additions and 30 deletions

BIN
misc/pman64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

9
progmgr/desktop.c Normal file
View File

@@ -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
\* * * * * * * */

Binary file not shown.

View File

@@ -12,7 +12,11 @@
#include "resource.h" #include "resource.h"
#include "registry.h" #include "registry.h"
// #define WIN32_LEAN_AND_MEAN // #define WIN32_LEAN_AND_MEAN
#define SECURITY_WIN32
#include <Windows.h> #include <Windows.h>
#include <strsafe.h>
#include <Lmcons.h>
#include <security.h>
/* Variables */ /* Variables */
// Global // Global
@@ -24,15 +28,23 @@ WCHAR szWebsite[64];
// Window Related // Window Related
HICON hProgMgrIcon = NULL; HICON hProgMgrIcon = NULL;
HINSTANCE hAppInstance; HINSTANCE hAppInstance;
HWND hwndProgMgr = NULL; HWND hWndProgMgr = NULL;
HWND hwndMDIClient = 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) int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{ {
MSG msg = { 0 }; MSG msg = { 0 };
HANDLE hAccel;
WNDCLASS wc = { 0 }; WNDCLASS wc = { 0 };
WCHAR szClass[16]; WCHAR szClass[16];
WCHAR szUsername[UNLEN + 1] = L"";
DWORD dwUsernameLen = UNLEN;
WCHAR szWindowTitle[UNLEN + ARRAYSIZE(szAppTitle) + 4] = L"";
hAppInstance = hInstance; hAppInstance = hInstance;
@@ -48,29 +60,47 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
// Register the Frame Window // Register the Frame Window
wc.lpfnWndProc = WndProc; wc.lpfnWndProc = WndProc;
wc.hInstance = hAppInstance; 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.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND); wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND);
wc.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN); wc.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN);
wc.lpszClassName = szClass; wc.lpszClassName = szClass;
if (!RegisterClass(&wc)) if (!RegisterClass(&wc))
return 1; return FALSE;
// Load the Accelerator table
hAccel = LoadAccelerators(hAppInstance, MAKEINTRESOURCE(IDA_ACCELS));
if (!hAccel)
return FALSE;
InitializeRegistryKeys(); InitializeRegistryKeys();
//if (IsProgMgrDefaultShell) { //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, if (!CreateWindow(wc.lpszClassName,
szAppTitle, szWindowTitle,
WS_OVERLAPPEDWINDOW | WS_VISIBLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
160, 80, 640, 480, 0, 0, hInstance, NULL)) 160, 80, 640, 480, 0, 0, hAppInstance, NULL))
return 2; return 2;
//hSystemMenu = GetSystemMenu(hwndProgman, FALSE); //hSystemMenu = GetSystemMenu(hwndProgman, FALSE);
while (GetMessage(&msg, NULL, 0, 0) > 0) while (GetMessage(&msg, NULL, 0, 0) > 0)
DispatchMessage(&msg); {
if (!TranslateMDISysAccel(hWndMDIClient, &msg) &&
!TranslateAccelerator(hWndProgMgr, hAccel, &msg))
{
DispatchMessage(&msg);
}
}
return 0; return 0;
} }

View File

@@ -12,6 +12,7 @@
#pragma comment(linker,"\"/manifestdependency:type='win32' \ #pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#pragma comment(lib, "Secur32.lib")
/* Includes */ /* Includes */
#include <wtypes.h> #include <wtypes.h>
@@ -33,9 +34,10 @@ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
/* Global Variables */ /* Global Variables */
// PROGMGR.C // PROGMGR.C
extern BOOL bIsDefaultShell; extern BOOL bIsDefaultShell;
extern HICON hProgMgrIcon;
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];
@@ -46,4 +48,4 @@ BOOL RunFile(HWND hWndOwner, HICON hIcon, LPWSTR lpszDir, LPWSTR lpszTitle, LPWS
BOOL ShutdownDlg(HWND hWndOwner); BOOL ShutdownDlg(HWND hWndOwner);
// WNDPROC.C // WNDPROC.C
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 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);

View File

@@ -156,6 +156,7 @@
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="desktop.c" />
<ClCompile Include="progmgr.c" /> <ClCompile Include="progmgr.c" />
<ClCompile Include="registry.c" /> <ClCompile Include="registry.c" />
<ClCompile Include="shellint.c" /> <ClCompile Include="shellint.c" />

Binary file not shown.

View File

@@ -19,7 +19,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#include "lang\res_en-US.rc" // English (US) #include "lang\res_en-US.rc" // English (US)
/* Primary Icon Library */ /* 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 */ /* Secondary Icon Library */

View File

@@ -15,7 +15,6 @@
#include <Windows.h> #include <Windows.h>
/* Functions */ /* Functions */
/* * * *\ /* * * *\
WndProc - WndProc -
Program Manager's window procedure. Program Manager's window procedure.
@@ -24,7 +23,6 @@
\* * * */ \* * * */
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (message) { switch (message) {
case WM_CREATE: case WM_CREATE:
@@ -32,21 +30,22 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
RECT rc; RECT rc;
CLIENTCREATESTRUCT ccs; CLIENTCREATESTRUCT ccs;
hwndProgMgr = hWnd; // Frame Window
hWndProgMgr = hWnd;
// ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), IDM_WINDOW); // MDI Client Window
// ccs.idFirstChild = IDM_CHILDSTART; ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), IDM_WINDOW);
ccs.idFirstChild = IDM_WINDOW_CHILDSTART;
GetClientRect(hwndProgMgr, &rc); GetClientRect(hWndProgMgr, &rc);
hwndMDIClient = CreateWindow(TEXT("MDIClient"), hWndMDIClient = CreateWindow(L"MDIClient", NULL,
NULL, WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL,
WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_BORDER, // rc.left - 1, rc.top - 1, rc.right + 2, rc.bottom + 2,
rc.left - 1, rc.top - 1, 0, 0, 0, 0,
rc.right + 2, rc.bottom + 2, hWnd, (HMENU)1, hAppInstance, (LPWSTR)&ccs);
hWnd, (HMENU)1, hAppInstance,
(LPTSTR)&ccs); if (!hWndMDIClient) {
if (!hwndMDIClient) {
return -1; return -1;
} }
break; break;
@@ -83,7 +82,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
default: default:
WndProcDefault: WndProcDefault:
return DefWindowProc(hWnd, message, wParam, lParam); return DefFrameProc(hWnd, hWndMDIClient, message, wParam, lParam);
} }
return 0; return 0;
@@ -114,11 +113,10 @@ LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam)
case IDM_HELP_ABOUT: case IDM_HELP_ABOUT:
{ {
WCHAR szTitle[40]; WCHAR szTitle[40];
OutputDebugString(L"ABOUT BALLS!"); // OutputDebugString(L"ABOUT BALLS!");
HICON hIcon = LoadIcon(hAppInstance, MAKEINTRESOURCE(PROGMGRICON));
LoadString(hAppInstance, IDS_APPTITLE, szTitle, CharSizeOf(szTitle)); LoadString(hAppInstance, IDS_APPTITLE, szTitle, CharSizeOf(szTitle));
ShellAbout(hwndProgMgr, szTitle, NULL, hIcon); ShellAbout(hWndProgMgr, szTitle, NULL, hProgMgrIcon);
break; break;
} }
@@ -127,4 +125,15 @@ LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam)
} }
return TRUE; 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;
} }