This commit is contained in:
Brady McDermott
2024-07-30 22:18:38 -06:00
parent bcd6716fcb
commit e0670bea6d
6 changed files with 8 additions and 261 deletions

View File

@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33723.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "progmgr", "progmgr\progmgr.vcxproj", "{B76B940D-B61A-456E-8569-72F64CF91AFB}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProgMgr", "ProgMgr\ProgMgr.vcxproj", "{B76B940D-B61A-456E-8569-72F64CF91AFB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@@ -1,202 +0,0 @@
/* * * * * * * *\
DESKTOP.C -
Copyright (c) 2024 Vortesys, Brady McDermott
DESCRIPTION -
Program Manager's desktop window.
Only visible as the default shell.
LICENSE INFORMATION -
MIT License, see LICENSE.txt in the root folder
\* * * * * * * */
/* Headers */
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <CommCtrl.h>
#include "progmgr.h"
#include "resource.h"
/* Structures */
typedef struct _mrp
{
HWND hWndMRP;
DWORD dwFlags;
} MRP, * PMRP;
/* Defines */
// MRP Flags
#define MRP_ICONIFIED 0x000000001
#define MRP_FLASHING 0x000000002
// Miscellaneous
#define MAXTITLELEN 256
#define ID_LISTVIEW 1000
/* Variables */
HWND hWndDesktop;
HWND hWndDesktopListView;
RECT rcRoot;
/* Functions */
LRESULT CALLBACK DeskWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
HWND CreateListView(HWND hWndParent, RECT rc);
/* * * *\
CreateDesktopWindow -
Creates the invisible desktop window.
RETURNS -
True if successful, false if unsuccessful.
\* * * */
BOOL CreateDesktopWindow(VOID)
{
MSG msg = { 0 };
WNDCLASSEX wc = { 0 };
WCHAR szBuffer[MAX_PATH];
WCHAR szClass[16];
// If we fail, we shouldn't be here anyways.
//if (GetShellWindow())
// return FALSE;
// Get size of the root HWND
GetWindowRect(GetDesktopWindow(), &rcRoot);
// Load the window class string
LoadString(hAppInstance, IDS_DTCLASS, szClass, ARRAYSIZE(szClass));
// 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. Doesn't work with multiple monitors.
SystemParametersInfo(SPI_SETWORKAREA, 0, &rcRoot, SPIF_SENDCHANGE);
// Register the desktop window
wc.cbSize = sizeof(WNDCLASSEX);
wc.lpfnWndProc = DeskWndProc;
wc.hInstance = hAppInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(COLOR_WINDOW);
wc.style = CS_NOCLOSE;
wc.lpszClassName = szClass;
if (!RegisterClassEx(&wc))
return FALSE;
if (CreateWindowEx(WS_EX_TOOLWINDOW, wc.lpszClassName,
NULL, WS_VISIBLE, rcRoot.left, rcRoot.top,
rcRoot.right - rcRoot.left, rcRoot.bottom - rcRoot.top,
NULL, NULL, hAppInstance, NULL) == NULL);
return 2;
while (GetMessage(&msg, NULL, 0, 0) > 0)
{
DispatchMessage(&msg);
}
return TRUE;
}
/* * * *\
DeskWndProc -
Program Manager's desktop window procedure.
RETURNS -
Zero if nothing, otherwise returns the good stuff.
\* * * */
LRESULT CALLBACK DeskWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
// Populate hWndDesktop
hWndDesktop = hWnd;
// Set the window position to shell
// SetShellWindow(hWndDesktop);
ShowWindow(hWndDesktop, SW_MAXIMIZE);
// Strip the border from the desktop window
SetWindowLongPtr(hWndDesktop, GWL_STYLE, WS_POPUP);
// Size the window to take up the primary monitor's desktop
SetWindowPos(hWndDesktop, HWND_BOTTOM,
rcRoot.left, rcRoot.top, rcRoot.right - rcRoot.left, rcRoot.bottom - rcRoot.top,
SWP_FRAMECHANGED | SWP_NOACTIVATE);
// Finally, bring Program Manager to the foreground.
SetWindowPos(hWndProgMgr, HWND_TOP,
0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
// Finally, Create the ListView control
//hWndListView = CreateListView(hWndDesktop, rcRoot);
break;
case WM_ACTIVATE:
case WM_DISPLAYCHANGE:
case WM_DEVICECHANGE:
// Get size of the root HWND
GetWindowRect(GetDesktopWindow(), &rcRoot);
SetWindowPos(hWndDesktop, HWND_BOTTOM,
rcRoot.left, rcRoot.top, rcRoot.right - rcRoot.left, rcRoot.bottom - rcRoot.top,
SWP_NOACTIVATE);
//if (hWndListView)
// SetWindowPos(hWndListView, hWndDesktop,
// rcRoot.left, rcRoot.top, rcRoot.right - rcRoot.left, rcRoot.bottom - rcRoot.top,
// SWP_NOZORDER | SWP_NOACTIVATE);
break;
case WM_WINDOWPOSCHANGING:
case WM_SYSCOMMAND:
case WM_COMMAND:
break;
case WM_DESTROY:
case WM_CLOSE:
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
/* * * *\
CreateListView -
Creates the Desktop's ListView.
RETURNS -
HWND to the listview if successfull,
NULL otherwise.
\* * * */
HWND CreateListView(HWND hWndParent, RECT rc)
{
HWND hWndDesktopListView;
LVITEM lviTestItem;
WCHAR szTestItem[] = TEXT("Test Item");
// Create the ListView
hWndDesktopListView = CreateWindowEx(WS_EX_LEFT, WC_LISTVIEW, TEXT(""),
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
LVS_ICON | LVS_SINGLESEL,
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
hWndParent, (HMENU)ID_LISTVIEW, hAppInstance,
NULL);
if(hWndDesktopListView == NULL)
return NULL;
ListView_SetBkColor(hWndDesktopListView, CLR_NONE);
lviTestItem.mask = LVIF_STATE | LVIF_TEXT;
lviTestItem.iItem = 0;
lviTestItem.iSubItem = 0;
lviTestItem.state = 0;
lviTestItem.stateMask = 0;
lviTestItem.pszText = (LPWSTR)&szTestItem;
lviTestItem.cchTextMax = MAXTITLELEN;
// lviTestItem.iImage = 1;
ListView_InsertItem(hWndDesktopListView, &lviTestItem);
return hWndDesktopListView;
}

View File

@@ -1,44 +0,0 @@
/* * * * * * * *\
DESKTOP2.C -
Copyright (c) 2024 Vortesys, Brady McDermott
DESCRIPTION -
Program Manager's desktop window.
Displays running programs.
LICENSE INFORMATION -
MIT License, see LICENSE.txt in the root folder
\* * * * * * * */
/* Headers */
#include <Windows.h>
#include "progmgr.h"
/* Structures */
typedef struct _DPI
{
HWND hWnd;
HICON hIcon;
DWORD dwFlags;
} DPI, * PDPI;
/* * * *\
CreateDesktopWindow2 -
Creates the desktop window.
RETURNS -
TRUE if created successfully,
FALSE if otherwise.
\* * * */
BOOL CreateDesktopWindow2(VOID)
{
// TODO:
// Create window, resize it to the size of the screen
// possibly create child windows for other monitors
// color the window invisible, get list of running
// programs and then draw them all and capture their
// system menus as context menus for each icon.
// FUNCTIONS TODO:
// QueryRunningPrograms()
// DrawProgramIcon(DWORD dwFlags)
//
return TRUE;
}

View File

@@ -50,8 +50,6 @@ extern BOOL bPermPower; // Has power option permissions
/* Function Prototypes */
BOOL UpdatePermissions(VOID);
// DESKTOP.C
BOOL CreateDesktopWindow(VOID);
// SYSINT.C
BOOL RunFileDlg(HWND hWndOwner, HICON hIcon, LPWSTR lpszDir, LPWSTR lpszTitle, LPWSTR lpszDesc, DWORD dwFlags);
BOOL ExitWindowsDialog(HWND hWndOwner);

View File

@@ -177,8 +177,6 @@
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="desktop.c" />
<ClCompile Include="desktop2.c" />
<ClCompile Include="dialog.c" />
<ClCompile Include="progmgr.c" />
<ClCompile Include="registry.c" />

View File

@@ -16,6 +16,9 @@
<Filter Include="Language Resources">
<UniqueIdentifier>{71dbbd6d-c82a-4fac-a0ff-74be88190f82}</UniqueIdentifier>
</Filter>
<Filter Include="Resource Files\en-US">
<UniqueIdentifier>{2a11d118-5a5c-4681-86dc-31de4f0251ff}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="progmgr.h">
@@ -44,9 +47,6 @@
<ClCompile Include="registry.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="desktop.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="sysint.c">
<Filter>Source Files</Filter>
</ClCompile>
@@ -59,19 +59,16 @@
<ClCompile Include="dialog.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="desktop2.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
<ResourceCompile Include="lang\dlg_en-US.rc">
<Filter>Language Resources</Filter>
</ResourceCompile>
<ResourceCompile Include="lang\res_en-US.rc">
<Filter>Language Resources</Filter>
<Filter>Resource Files\en-US</Filter>
</ResourceCompile>
<ResourceCompile Include="lang\dlg_en-US.rc">
<Filter>Resource Files\en-US</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>