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 "registry.h"
// #define WIN32_LEAN_AND_MEAN
#define SECURITY_WIN32
#include <Windows.h>
#include <strsafe.h>
#include <Lmcons.h>
#include <security.h>
/* 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;
}

View File

@@ -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 <wtypes.h>
@@ -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);

View File

@@ -156,6 +156,7 @@
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="desktop.c" />
<ClCompile Include="progmgr.c" />
<ClCompile Include="registry.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)
/* 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 */

View File

@@ -15,7 +15,6 @@
#include <Windows.h>
/* 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;
}