From 8a2a2c6d21f7bbf694a8696cab8a87bfc6366689 Mon Sep 17 00:00:00 2001 From: freedom Date: Fri, 21 Jul 2023 01:37:36 -0600 Subject: [PATCH] added manifest, renamed the run dialog function --- progmgr/progmgr.c | 13 +++++++-- progmgr/progmgr.exe.manifest | 52 +++++++++++++++++++++++++++++++++ progmgr/progmgr.h | 5 +--- progmgr/progmgr.vcxproj | 11 +++++++ progmgr/progmgr.vcxproj.filters | 14 +++++++++ progmgr/resource.rc | 3 ++ progmgr/shellint.c | 4 +-- progmgr/wndproc.c | 2 +- 8 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 progmgr/progmgr.exe.manifest diff --git a/progmgr/progmgr.c b/progmgr/progmgr.c index ae399c0..1c29619 100644 --- a/progmgr/progmgr.c +++ b/progmgr/progmgr.c @@ -43,11 +43,12 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi HMENU hMenu; HMENU hSystemMenu; WNDCLASS wc = { 0 }; - WCHAR szBuffer[256]; + WCHAR szBuffer[MAX_PATH]; WCHAR szClass[16]; WCHAR szUsername[UNLEN + 1] = L""; DWORD dwUsernameLen = UNLEN; WCHAR szWindowTitle[UNLEN + ARRAYSIZE(szAppTitle) + 4] = L""; + RECT rWorkArea; hAppInstance = hInstance; @@ -99,7 +100,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi hSystemMenu = GetSystemMenu(hWndProgMgr, FALSE); if (bIsDefaultShell) { - // Do all the fun stuff since we're the default shell + // Modify the context menus since we're the default shell DeleteMenu(hSystemMenu, SC_CLOSE, MF_BYCOMMAND); LoadString(hAppInstance, IDS_SHUTDOWN, szBuffer, ARRAYSIZE(szBuffer)); @@ -111,6 +112,14 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi LoadString(hAppInstance, IDS_TASKMGR, szBuffer, ARRAYSIZE(szBuffer)); InsertMenu(hSystemMenu, 6, MF_BYPOSITION | MF_STRING, IDM_TASKMGR, szBuffer); + + // Refresh the wallpaper... + SystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szBuffer, 0); + SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, szBuffer, SPIF_SENDCHANGE); + + // Reset the work area (removes dead-space after switching from another shell) + // May have unintended consequences. + SystemParametersInfo(SPI_SETWORKAREA, 0, (PVOID)&rWorkArea, SPIF_SENDCHANGE); } while (GetMessage(&msg, NULL, 0, 0) > 0) diff --git a/progmgr/progmgr.exe.manifest b/progmgr/progmgr.exe.manifest new file mode 100644 index 0000000..7c93cc6 --- /dev/null +++ b/progmgr/progmgr.exe.manifest @@ -0,0 +1,52 @@ + + + + Program Manager II + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/progmgr/progmgr.h b/progmgr/progmgr.h index ce8ecf9..1a815ff 100644 --- a/progmgr/progmgr.h +++ b/progmgr/progmgr.h @@ -9,9 +9,6 @@ /* Pragmas */ #pragma once -#pragma comment(linker,"\"/manifestdependency:type='win32' \ -name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ -processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #pragma comment(lib, "Shlwapi.lib") #pragma comment(lib, "Secur32.lib") @@ -44,7 +41,7 @@ extern WCHAR szWebsite[64]; /* Function Prototypes */ // SHELLINT.C -BOOL RunFile(HWND hWndOwner, HICON hIcon, LPWSTR lpszDir, LPWSTR lpszTitle, LPWSTR lpszDesc, DWORD dwFlags); +BOOL RunFileDlg(HWND hWndOwner, HICON hIcon, LPWSTR lpszDir, LPWSTR lpszTitle, LPWSTR lpszDesc, DWORD dwFlags); BOOL ExitWindowsDialog(HWND hWndOwner); // WNDPROC.C LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/progmgr/progmgr.vcxproj b/progmgr/progmgr.vcxproj index ce57623..ed5bcd1 100644 --- a/progmgr/progmgr.vcxproj +++ b/progmgr/progmgr.vcxproj @@ -73,18 +73,22 @@ $(SolutionDir)\bin\$(Platform)\$(Configuration)\ $(OutDir) + false $(SolutionDir)\bin\$(Platform)\$(Configuration)\ $(OutDir) + false $(SolutionDir)\bin\$(Platform)\$(Configuration)\ $(OutDir) + false $(SolutionDir)\bin\$(Platform)\$(Configuration)\ $(OutDir) + false @@ -98,6 +102,7 @@ true $(OutDir)$(TargetName)$(TargetExt) 5.02 + $(IntDir)$(TargetName)$(TargetExt).manifest @@ -116,6 +121,7 @@ true $(OutDir)$(TargetName)$(TargetExt) 5.02 + $(IntDir)$(TargetName)$(TargetExt).manifest @@ -130,6 +136,7 @@ true $(OutDir)$(TargetName)$(TargetExt) 5.02 + $(IntDir)$(TargetName)$(TargetExt).manifest @@ -148,6 +155,7 @@ true $(OutDir)$(TargetName)$(TargetExt) 5.02 + $(IntDir)$(TargetName)$(TargetExt).manifest @@ -170,6 +178,9 @@ + + + diff --git a/progmgr/progmgr.vcxproj.filters b/progmgr/progmgr.vcxproj.filters index 5ffe778..59b4f0b 100644 --- a/progmgr/progmgr.vcxproj.filters +++ b/progmgr/progmgr.vcxproj.filters @@ -35,6 +35,15 @@ Source Files + + Source Files + + + Source Files + + + Source Files + @@ -52,4 +61,9 @@ Resource Files + + + Resource Files + + \ No newline at end of file diff --git a/progmgr/resource.rc b/progmgr/resource.rc index 2bb8675..c7ad88b 100644 --- a/progmgr/resource.rc +++ b/progmgr/resource.rc @@ -25,6 +25,9 @@ IDI_PROGITM ICON icons\pmitem.ico /* Secondary Icon Library */ +/* Manifest */ +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "progmgr.exe.manifest" + /* Version Information */ #define APSTUDIO_HIDDEN_SYMBOLS #include "version.inc" diff --git a/progmgr/shellint.c b/progmgr/shellint.c index 46af869..3299d63 100644 --- a/progmgr/shellint.c +++ b/progmgr/shellint.c @@ -14,12 +14,12 @@ /* Functions */ /* * * *\ - RunFile - + RunFileDlg - Produces a Run dialog window. RETURNS - True if successful, false if unsuccessful. \* * * */ -BOOL RunFile(HWND hWndOwner, +BOOL RunFileDlg(HWND hWndOwner, HICON hIcon, LPWSTR lpszDir, LPWSTR lpszTitle, diff --git a/progmgr/wndproc.c b/progmgr/wndproc.c index 24594ee..cd31f93 100644 --- a/progmgr/wndproc.c +++ b/progmgr/wndproc.c @@ -106,7 +106,7 @@ LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam) break; case IDM_FILE_RUN: - RunFile(hWnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY); + RunFileDlg(hWnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY); break; case IDM_FILE_EXIT: