4 Commits

Author SHA1 Message Date
freedom
c963301105 fix always on top menu option 2023-08-01 13:05:03 -06:00
freedom
c62bc10490 update username on the fly 2023-08-01 13:03:22 -06:00
freedom
9518a5e30b readme EVEN HARDER!!!!!!!!!!!!!!!!! 2023-08-01 02:13:19 -06:00
freedom
90d4fce8aa update readme, forgot that, whoops 2023-08-01 01:58:50 -06:00
5 changed files with 47 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
[![Latest version](https://img.shields.io/github/v/release/VortexSystems/Program-Manager-II?label=latest%20version&sort=semver&style=plastic)](/releases) [![Latest pre-release version](https://img.shields.io/github/v/release/VortexSystems/Program-Manager-II?label=latest%20pre-release%20version&sort=semver&style=plastic&include_prereleases)](/releases)
[![Latest version](https://img.shields.io/github/v/release/Vortesys/Program-Manager-II?label=latest%20version&sort=semver&style=plastic)](https://github.com/Vortesys/Program-Manager-II/releases) [![Latest pre-release version](https://img.shields.io/github/v/release/Vortesys/Program-Manager-II?label=latest%20pre-release%20version&sort=semver&style=plastic&include_prereleases)](https://github.com/Vortesys/Program-Manager-II/releases)
# Program Manager *II* for Windows NT
![Progmgr banner](/misc/pman2.png)
@@ -9,7 +9,7 @@ Program Manager was the shell that shipped with Microsoft Windows by default fro
Program Manager should run on ~~every AMD64 version of Windows and every 32-bit version back to 2000. The ultimate goal is to run on NT 3.51 just as well as it can run on Windows 11~~ Windows Vista and above.
## Where do I get it?
The [releases page](/releases) will contain the latest version of Program Manager.
The [releases page](https://github.com/Vortesys/Program-Manager-II/releases) will contain the latest version of Program Manager.
## How can I help?
Submitting [issues](/issues) with bug reports, suggestions or comments always helps. If you're able to, contributing with a [pull request](/pulls) is much appreciated.
Submitting [issues](https://github.com/Vortesys/Program-Manager-II/issues) with bug reports, suggestions or comments always helps. If you're able to, contributing with a [pull request](https://github.com/Vortesys/Program-Manager-II/pulls) is much appreciated.

View File

@@ -173,7 +173,7 @@ HWND CreateListView(HWND hWndParent, RECT rc)
{
HWND hWndListView;
LVITEM lviTestItem;
//WCHAR szTestItem[20] = L"Test Item\0";
//WCHAR szTestItem[] = L"Test Item\0";
// Create the ListView
hWndListView = CreateWindowEx(WS_EX_LEFT, WC_LISTVIEW, L"",

View File

@@ -14,9 +14,6 @@
// #define WIN32_LEAN_AND_MEAN
#define SECURITY_WIN32
#include <Windows.h>
#include <strsafe.h>
#include <Lmcons.h>
#include <security.h>
/* Variables */
// Global
@@ -37,7 +34,7 @@ HWND hWndMDIClient = NULL;
wWinMain -
Program Manager's entry point.
\* * * */
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow)
{
MSG msg = { 0 };
HANDLE hAccel;
@@ -46,9 +43,6 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
WNDCLASS wc = { 0 };
WCHAR szBuffer[MAX_PATH];
WCHAR szClass[16];
WCHAR szUsername[UNLEN + 1] = L"";
DWORD dwUsernameLen = UNLEN;
WCHAR szWindowTitle[UNLEN + ARRAYSIZE(szAppTitle) + 4] = L"";
RECT rcRoot;
POINT ptOffset;
@@ -58,7 +52,6 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
LoadString(hAppInstance, IDS_PMCLASS, szClass, ARRAYSIZE(szClass));
LoadString(hAppInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle));
LoadString(hAppInstance, IDS_WEBSITE, szWebsite, ARRAYSIZE(szWebsite));
GetUserNameEx(NameSamCompatible, szUsername, &dwUsernameLen);
// Get Desktop background color
//CreateSolidBrush(GetBackgroundColor
@@ -91,15 +84,6 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
return FALSE;
}
// Add username to window title if settings permit
StringCchCopy(szWindowTitle, ARRAYSIZE(szAppTitle), szAppTitle);
if (bShowUsername)
{
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), L" - ");
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), szUsername);
}
// Get size of the root HWND
GetWindowRect(GetDesktopWindow(), &rcRoot);
@@ -109,7 +93,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
// Create main window with a default size
// NOTE: i pulled 320x240 out of my ass, make this dynamic later
if (!CreateWindow(wc.lpszClassName, szWindowTitle, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
if (!CreateWindow(wc.lpszClassName, szAppTitle, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
rcRoot.left + ptOffset.x, rcRoot.top + ptOffset.y,
rcRoot.left + ptOffset.x + 320, rcRoot.top + ptOffset.y + 240,
0, 0, hAppInstance, NULL))
@@ -126,13 +110,15 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
hMenu = GetMenu(hWndProgMgr);
hSystemMenu = GetSystemMenu(hWndProgMgr, FALSE);
// Update our menu checkmarks
// Update relevant parts of the window
UpdateChecks(bAutoArrange, IDM_OPTIONS, IDM_OPTIONS_AUTOARRANGE);
UpdateChecks(bMinOnRun, IDM_OPTIONS, IDM_OPTIONS_MINONRUN);
UpdateChecks(bTopMost, IDM_OPTIONS, IDM_OPTIONS_TOPMOST);
UpdateChecks(bShowUsername, IDM_OPTIONS, IDM_OPTIONS_SHOWUSERNAME);
UpdateChecks(bSaveSettings, IDM_OPTIONS, IDM_OPTIONS_SAVESETTINGS);
UpdateWindowTitle();
// Update settings based on their values
if (bTopMost)
SetWindowPos(hWndProgMgr, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

View File

@@ -49,4 +49,5 @@ BOOL SetShellWindow(HWND hWndShell);
// WNDPROC.C
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam);
VOID UpdateChecks(BOOL bVarMenu, UINT uSubMenu, UINT uID);
VOID UpdateChecks(BOOL bVarMenu, UINT uSubMenu, UINT uID);
VOID UpdateWindowTitle();

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>
/* Functions */
@@ -137,12 +141,13 @@ LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam)
case IDM_OPTIONS_TOPMOST:
bTopMost = !bTopMost;
SetWindowPos(hWndProgMgr, bTopMost ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE);
SetWindowPos(hWndProgMgr, bTopMost ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
UpdateChecks(bTopMost, IDM_OPTIONS, IDM_OPTIONS_TOPMOST);
goto SaveConfig;
case IDM_OPTIONS_SHOWUSERNAME:
bShowUsername = !bShowUsername;
UpdateWindowTitle();
UpdateChecks(bShowUsername, IDM_OPTIONS, IDM_OPTIONS_SHOWUSERNAME);
goto SaveConfig;
@@ -192,6 +197,36 @@ VOID UpdateChecks(BOOL bVarMenu, UINT uSubMenu, UINT uID)
return;
}
/* * * *\
UpdateWindowTitle -
Updates Window title based on settings... and
current foreground group window if applicable?
RETURNS -
Nothing!
\* * * */
VOID UpdateWindowTitle()
{
WCHAR szUsername[UNLEN + 1] = L"";
DWORD dwUsernameLen = UNLEN;
WCHAR szWindowTitle[UNLEN + ARRAYSIZE(szAppTitle) + 4] = L"";
// Get user and domain name
GetUserNameEx(NameSamCompatible, szUsername, &dwUsernameLen);
// Add username to window title if settings permit
StringCchCopy(szWindowTitle, ARRAYSIZE(szAppTitle), szAppTitle);
if (bShowUsername)
{
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), L" - ");
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), szUsername);
}
SetWindowText(hWndProgMgr, (LPCWSTR)&szWindowTitle);
return;
}
/* * * *\
ChildWndProc -
Program Manager's window procedure.