Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2972d54777 | ||
|
|
6aaabd480a | ||
|
|
e400645956 | ||
|
|
77512dd72d | ||
|
|
8fb871de34 | ||
|
|
d41f0b868b | ||
|
|
b9cea5b8e6 | ||
|
|
745030da99 | ||
|
|
739c56e314 | ||
|
|
78f612e684 | ||
|
|
1bb6e0b05a | ||
|
|
541c86b4a2 | ||
|
|
f632229b3c | ||
|
|
488070e73d | ||
|
|
f8578360f8 | ||
|
|
a4f7046760 | ||
|
|
364afc7438 | ||
|
|
bbde0b6acb | ||
|
|
3441f7771a | ||
|
|
6302272d96 | ||
|
|
7409d6cc41 | ||
|
|
db71fb2ab3 | ||
|
|
84c62213d7 | ||
|
|
437703e26d | ||
|
|
fbdb45b4df | ||
|
|
ba276117d7 | ||
|
|
35a28f698f | ||
|
|
bf2c7ce3da | ||
|
|
4095f501c1 | ||
|
|
2632512881 | ||
|
|
af3e493085 | ||
|
|
d875363d72 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -57,3 +57,4 @@ dkms.conf
|
|||||||
/bin/
|
/bin/
|
||||||
/misc/supermiumman.png
|
/misc/supermiumman.png
|
||||||
/bin.7z
|
/bin.7z
|
||||||
|
*.zip
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
7z a -r "%~dp0bin\bin.7z" "%~dp0bin\*.exe"
|
|
||||||
WinRAR a -r "%~dp0bin\bin.rar" "%~dp0bin\*.exe"
|
|
||||||
del /s "%~dp0bin\*.exe"
|
|
||||||
pause
|
|
||||||
BIN
misc/pman2.png
BIN
misc/pman2.png
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 21 KiB |
201
progmgr/dialog.c
Normal file
201
progmgr/dialog.c
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
/* * * * * * * *\
|
||||||
|
DIALOG.C -
|
||||||
|
Copyright (c) 2023 freedom7341, Vortesys
|
||||||
|
DESCRIPTION -
|
||||||
|
Program Manager's dialogs and related
|
||||||
|
common functions.
|
||||||
|
LICENSE INFORMATION -
|
||||||
|
MIT License, see LICENSE.txt in the root folder
|
||||||
|
\* * * * * * * */
|
||||||
|
|
||||||
|
/* Headers */
|
||||||
|
#include "progmgr.h"
|
||||||
|
#include "dialog.h"
|
||||||
|
#include "group.h"
|
||||||
|
#include "resource.h"
|
||||||
|
// #define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <Shlobj.h>
|
||||||
|
#include <strsafe.h>
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
NewGroupDlgProc -
|
||||||
|
Dialog procedure for creating a group.
|
||||||
|
RETURNS -
|
||||||
|
TRUE if message is handled, FALSE otherwise.
|
||||||
|
\* * * */
|
||||||
|
BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
GROUP grp = {
|
||||||
|
.dwSignature = GRP_SIGNATURE,
|
||||||
|
.wVersion = GRP_VERSION,
|
||||||
|
.wChecksum = 0,
|
||||||
|
.szName = L"",
|
||||||
|
.dwFlags = 0,
|
||||||
|
.ftLastWrite = 0,
|
||||||
|
.cItems = 0,
|
||||||
|
.iItems = NULL
|
||||||
|
};
|
||||||
|
BOOL bOKEnabled = FALSE;
|
||||||
|
WCHAR szBuffer[MAX_TITLE_LENGTH] = { L"\0" };
|
||||||
|
HICON hIconDef = NULL;
|
||||||
|
HICON hIconDlg = NULL;
|
||||||
|
WCHAR szIconPath[MAX_PATH] = { L"\0" };
|
||||||
|
INT iIconIndex = 0;
|
||||||
|
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
// TODO:
|
||||||
|
// Enable creation of common groups (enable the controls)
|
||||||
|
// if permissions are available.
|
||||||
|
// TODO:
|
||||||
|
// fix minor GDI font/region leak
|
||||||
|
|
||||||
|
// Populate the icon with the default path and index.
|
||||||
|
GetModuleFileName(NULL, (LPWSTR)&szIconPath, MAX_PATH);
|
||||||
|
iIconIndex = IDI_PROGGRP - 1;
|
||||||
|
|
||||||
|
// Get the default hIcon so we can delete it later
|
||||||
|
hIconDef = (HICON)SendDlgItemMessage(hWndDlg, IDD_STAT_ICON, STM_GETICON, 0, 0);
|
||||||
|
|
||||||
|
// Set the icon in the dialog
|
||||||
|
hIconDlg = ExtractIcon(hAppInstance, (LPWSTR)&szIconPath, iIconIndex);
|
||||||
|
SendDlgItemMessage(hWndDlg, IDD_STAT_ICON, STM_SETICON, (WPARAM)hIconDlg, 0);
|
||||||
|
|
||||||
|
// Set the maximum input length of the text boxes
|
||||||
|
SendDlgItemMessage(hWndDlg, IDD_NAME, EM_LIMITTEXT, MAX_TITLE_LENGTH, 0);
|
||||||
|
|
||||||
|
// Disable the OK button since we're starting with no text in the box.
|
||||||
|
EnableWindow(GetDlgItem(hWndDlg, IDD_OK), bOKEnabled);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
|
||||||
|
if (HIWORD(wParam) == EN_CHANGE)
|
||||||
|
{
|
||||||
|
if (LOWORD(wParam) == IDD_NAME)
|
||||||
|
{
|
||||||
|
// Name text control changed. See what's up...
|
||||||
|
bOKEnabled = GetDlgItemText(hWndDlg, IDD_NAME, (LPWSTR)&szBuffer, ARRAYSIZE(szBuffer));
|
||||||
|
|
||||||
|
// Enable or disable the OK button based on the information
|
||||||
|
EnableWindow(GetDlgItem(hWndDlg, IDD_OK), bOKEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (GET_WM_COMMAND_ID(wParam, lParam))
|
||||||
|
{
|
||||||
|
|
||||||
|
case IDD_CHICON:
|
||||||
|
if (PickIconDlg(hWndDlg, (LPWSTR)&szIconPath, ARRAYSIZE(szIconPath), &iIconIndex) == TRUE)
|
||||||
|
{
|
||||||
|
// Since we've got the new icon...
|
||||||
|
hIconDlg = ExtractIcon(hAppInstance, (LPWSTR)&szIconPath, iIconIndex);
|
||||||
|
SendDlgItemMessage(hWndDlg, IDD_STAT_ICON, STM_SETICON, (WPARAM)hIconDlg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDD_OK:
|
||||||
|
// Check that all the applicable fields are filled out
|
||||||
|
bOKEnabled = GetDlgItemText(hWndDlg, IDD_NAME, (LPWSTR)&szBuffer, ARRAYSIZE(szBuffer));
|
||||||
|
|
||||||
|
// If not, set the focus to the offending field
|
||||||
|
if (!bOKEnabled)
|
||||||
|
SendDlgItemMessage(hWndDlg, IDD_NAME, EM_TAKEFOCUS, 0, 0);
|
||||||
|
|
||||||
|
// Enable or disable the OK button based on the information
|
||||||
|
EnableWindow(GetDlgItem(hWndDlg, IDD_OK), bOKEnabled);
|
||||||
|
|
||||||
|
if (bOKEnabled)
|
||||||
|
{
|
||||||
|
// Set the name of the group
|
||||||
|
StringCchCopy(grp.szName, ARRAYSIZE(szBuffer), szBuffer);
|
||||||
|
|
||||||
|
// Set the flags of the group
|
||||||
|
if (SendDlgItemMessage(hWndDlg, IDD_COMMGROUP, BM_GETCHECK, 0, 0) != BST_UNCHECKED)
|
||||||
|
grp.dwFlags = grp.dwFlags || GRP_FLAG_COMMON;
|
||||||
|
|
||||||
|
// TODO: set FILETIME
|
||||||
|
|
||||||
|
// Set the rectangle of the group to be CW_USEDEFAULT
|
||||||
|
grp.rcGroup.left = grp.rcGroup.top = grp.rcGroup.right = grp.rcGroup.bottom = CW_USEDEFAULT;
|
||||||
|
|
||||||
|
// Set icon properties
|
||||||
|
StringCchCopy(grp.szIconPath, ARRAYSIZE(szIconPath), szIconPath);
|
||||||
|
grp.iIconIndex = iIconIndex;
|
||||||
|
|
||||||
|
// Group's ready!
|
||||||
|
if (CreateGroupWindow(&grp) != NULL)
|
||||||
|
{
|
||||||
|
EndDialog(hWndDlg, FALSE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Failure!
|
||||||
|
EndDialog(hWndDlg, FALSE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDD_CANCEL:
|
||||||
|
EndDialog(hWndDlg, FALSE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Cleanup
|
||||||
|
if (hIconDef)
|
||||||
|
DestroyIcon(hIconDef);
|
||||||
|
if (hIconDlg)
|
||||||
|
DestroyIcon(hIconDlg);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
NewItemDlgProc -
|
||||||
|
Dialog procedure for creating or modifying
|
||||||
|
an item.
|
||||||
|
RETURNS -
|
||||||
|
TRUE if message is handled, FALSE otherwise.
|
||||||
|
\* * * */
|
||||||
|
BOOL CALLBACK NewItemDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
// Place message cases here.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch (GET_WM_COMMAND_ID(wParam, lParam))
|
||||||
|
{
|
||||||
|
|
||||||
|
case IDD_CANCEL:
|
||||||
|
EndDialog(hWndDlg, FALSE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
16
progmgr/dialog.h
Normal file
16
progmgr/dialog.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/* * * * * * * *\
|
||||||
|
DIALOG.H -
|
||||||
|
Copyright (c) 2023 freedom7341, Vortesys
|
||||||
|
DESCRIPTION -
|
||||||
|
Dialog function prototypes and related
|
||||||
|
common dialog functions.
|
||||||
|
LICENSE INFORMATION -
|
||||||
|
MIT License, see LICENSE.txt in the root folder
|
||||||
|
\* * * * * * * */
|
||||||
|
|
||||||
|
/* Pragmas */
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* Function Prototypes */
|
||||||
|
BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
BOOL CALLBACK NewItemDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
241
progmgr/group.c
241
progmgr/group.c
@@ -14,12 +14,219 @@
|
|||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
// #define WIN32_LEAN_AND_MEAN
|
// #define WIN32_LEAN_AND_MEAN
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#include <strsafe.h>
|
||||||
|
|
||||||
/* Variables */
|
/* Variables */
|
||||||
WNDCLASSEX wcGrp;
|
WNDCLASSEX wcGrp;
|
||||||
|
WCHAR szGrpClass[16];
|
||||||
|
PGROUPWND pgwArray[];
|
||||||
|
HWND hWndMDIClient = NULL;
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
InitializeGroups -
|
||||||
|
Create the MDI Client window and initialize
|
||||||
|
the group window class.
|
||||||
|
RETURNS -
|
||||||
|
TRUE if groups are successfully created.
|
||||||
|
FALSE if otherwise.
|
||||||
|
\* * * */
|
||||||
|
BOOL InitializeGroups()
|
||||||
|
{
|
||||||
|
CLIENTCREATESTRUCT ccs = { 0 };
|
||||||
|
WNDCLASSEX wce = { 0 };
|
||||||
|
RECT rcFrame;
|
||||||
|
|
||||||
|
// Create the MDI Client Window
|
||||||
|
ccs.hWindowMenu = GetSubMenu(GetMenu(hWndProgMgr), IDM_WINDOW);
|
||||||
|
ccs.idFirstChild = IDM_WINDOW_CHILDSTART;
|
||||||
|
|
||||||
|
GetClientRect(hWndProgMgr, &rcFrame);
|
||||||
|
|
||||||
|
if (!(hWndMDIClient = CreateWindowEx(WS_EX_COMPOSITED, L"MDIClient",
|
||||||
|
NULL, WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,
|
||||||
|
rcFrame.left, rcFrame.top, rcFrame.right, rcFrame.bottom,
|
||||||
|
hWndProgMgr, (HMENU)1, hAppInstance, (LPWSTR)&ccs)))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the group class string
|
||||||
|
LoadString(hAppInstance, IDS_GRPCLASS, szGrpClass, ARRAYSIZE(szGrpClass));
|
||||||
|
|
||||||
|
// Register the group window Class
|
||||||
|
wce.cbSize = sizeof(WNDCLASSEX);
|
||||||
|
wce.lpfnWndProc = GroupWndProc;
|
||||||
|
wce.cbClsExtra = 0;
|
||||||
|
wce.cbWndExtra = 0;
|
||||||
|
wce.hInstance = hAppInstance;
|
||||||
|
wce.hIcon = hGroupIcon = LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_PROGGRP), IMAGE_ICON,
|
||||||
|
0, 0, LR_DEFAULTSIZE | LR_SHARED);
|
||||||
|
wce.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
|
wce.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||||
|
wce.lpszMenuName = NULL;
|
||||||
|
wce.lpszClassName = szGrpClass;
|
||||||
|
|
||||||
|
if (!RegisterClassEx(&wce))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// CreateGroupWindow(NULL);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
CreateGroupWindow -
|
||||||
|
Create an MDI window from a group structure
|
||||||
|
RETURNS -
|
||||||
|
Pointer to a group window structure
|
||||||
|
or NULL on failure
|
||||||
|
\* * * */
|
||||||
|
PGROUPWND CreateGroupWindow(PGROUP pgGroup)
|
||||||
|
{
|
||||||
|
GROUPWND gw = { NULL };
|
||||||
|
MDICREATESTRUCT mcs = { NULL };
|
||||||
|
HICON hIconBig = NULL;
|
||||||
|
HICON hIconSmall = NULL;
|
||||||
|
|
||||||
|
// Copy group structure to our group window
|
||||||
|
gw.grp = *pgGroup;
|
||||||
|
|
||||||
|
// TODO: allocate memory from pgwArray in here
|
||||||
|
|
||||||
|
// TODO: Automatically add itself to the array of
|
||||||
|
// PGW pointers?
|
||||||
|
|
||||||
|
// Get group minimized/maximized flags
|
||||||
|
|
||||||
|
mcs.szClass = szGrpClass;
|
||||||
|
mcs.szTitle = gw.grp.szName;
|
||||||
|
mcs.hOwner = hAppInstance;
|
||||||
|
if ((gw.grp.rcGroup.left == CW_USEDEFAULT) & (gw.grp.rcGroup.right == CW_USEDEFAULT))
|
||||||
|
{
|
||||||
|
mcs.x = mcs.y = mcs.cx = mcs.cy = CW_USEDEFAULT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mcs.x = gw.grp.rcGroup.left;
|
||||||
|
mcs.y = gw.grp.rcGroup.top;
|
||||||
|
mcs.cx = gw.grp.rcGroup.right - gw.grp.rcGroup.left;
|
||||||
|
mcs.cy = gw.grp.rcGroup.bottom - gw.grp.rcGroup.top;
|
||||||
|
}
|
||||||
|
mcs.style = WS_VISIBLE;
|
||||||
|
mcs.lParam = (LPARAM)pgGroup;
|
||||||
|
|
||||||
|
if (!(gw.hWndGroup = (HWND)SendMessage(hWndMDIClient, WM_MDICREATE, 0, (LPARAM)(LPTSTR)&mcs)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// Load the group icon
|
||||||
|
ExtractIconEx(gw.grp.szIconPath, gw.grp.iIconIndex, &hIconBig, &hIconSmall, 0);
|
||||||
|
SendMessage(gw.hWndGroup, WM_SETICON, ICON_SMALL, (LPARAM)hIconSmall);
|
||||||
|
SendMessage(gw.hWndGroup, WM_SETICON, ICON_BIG, (LPARAM)hIconBig);
|
||||||
|
|
||||||
|
// TODO: make sure the groups delete their icons upon destruction!
|
||||||
|
|
||||||
|
return &gw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
SetGroupFlags -
|
||||||
|
Retrieve the flags of a group window.
|
||||||
|
RETURNS -
|
||||||
|
TRUE if the flag mask is applied
|
||||||
|
FALSE if the flags aren't set
|
||||||
|
\* * * */
|
||||||
|
BOOL SetGroupFlags(PGROUPWND pgw, DWORD dwFlags)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
GetGroupFlags -
|
||||||
|
Retrieve the flags of a group window.
|
||||||
|
RETURNS -
|
||||||
|
TRUE if the flag mask is applied
|
||||||
|
FALSE if the flags aren't set
|
||||||
|
\* * * */
|
||||||
|
BOOL GetGroupFlags(PGROUPWND pgw, DWORD dwFlags)
|
||||||
|
{
|
||||||
|
HWND hWndGrp;
|
||||||
|
|
||||||
|
// Cancel if the group window doesn't exist
|
||||||
|
if (pgw == NULL)
|
||||||
|
return 0xFFFFFFFF;
|
||||||
|
|
||||||
|
// Get the window handle
|
||||||
|
hWndGrp = pgw->hWndGroup;
|
||||||
|
|
||||||
|
if (hWndGrp != NULL)
|
||||||
|
{
|
||||||
|
// NOTE: come back to this lol
|
||||||
|
// TODO: establish better what this actually does
|
||||||
|
// min/max flags are pulled from hwnd
|
||||||
|
// common/readonly flags are set upon group creation
|
||||||
|
// this means that some flags are static whereas
|
||||||
|
// others change over time, this means that we can
|
||||||
|
// either assume certain flags never change over time
|
||||||
|
// or grab them every time.
|
||||||
|
return 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
SaveGroup -
|
||||||
|
Saves group from a group window
|
||||||
|
into a GROUP structure.
|
||||||
|
ABSTRACT -
|
||||||
|
This function will extract all of the
|
||||||
|
necessary information from a group window
|
||||||
|
in order to produce a group structure.
|
||||||
|
RETURNS -
|
||||||
|
Formatted GROUP structure.
|
||||||
|
Upon failure, wChecksum will be 0.
|
||||||
|
\* * * */
|
||||||
|
GROUP SaveGroup(PGROUPWND pgw)
|
||||||
|
{
|
||||||
|
GROUP grp = {
|
||||||
|
.dwSignature = GRP_SIGNATURE,
|
||||||
|
.wVersion = GRP_VERSION,
|
||||||
|
.wChecksum = 0,
|
||||||
|
.szName = L"",
|
||||||
|
.dwFlags = 0,
|
||||||
|
.ftLastWrite = 0,
|
||||||
|
.cItems = 0,
|
||||||
|
.iItems = NULL
|
||||||
|
};
|
||||||
|
HWND hWndGrp;
|
||||||
|
WCHAR szGroupName[MAX_TITLE_LENGTH];
|
||||||
|
|
||||||
|
// Find the group and copy it
|
||||||
|
grp = pgw->grp;
|
||||||
|
|
||||||
|
// Get the window handle as well
|
||||||
|
hWndGrp = pgw->hWndGroup;
|
||||||
|
|
||||||
|
// Set the group checksum
|
||||||
|
grp.wChecksum = 1; // NOTE: implement this for real later lol
|
||||||
|
|
||||||
|
// Copy group information
|
||||||
|
GetWindowText(hWndGrp, szGroupName, MAX_TITLE_LENGTH);
|
||||||
|
StringCchCopy(grp.szName, MAX_TITLE_LENGTH, szGroupName);
|
||||||
|
|
||||||
|
grp.dwFlags = GRP_FLAG_MAXIMIZED;// GetGroupFlags(pgw);
|
||||||
|
|
||||||
|
GetSystemTimeAsFileTime(&grp.ftLastWrite);
|
||||||
|
|
||||||
|
// Save items...
|
||||||
|
grp.cItems = 0;
|
||||||
|
// TODO: iterate through listview to save items
|
||||||
|
|
||||||
|
return grp;
|
||||||
|
}
|
||||||
|
|
||||||
/* * * *\
|
/* * * *\
|
||||||
GroupWndProc -
|
GroupWndProc -
|
||||||
Group window procedure.
|
Group window procedure.
|
||||||
@@ -40,37 +247,3 @@ LRESULT CALLBACK GroupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* * * *\
|
|
||||||
InitGroups -
|
|
||||||
Initialize variables for the betterment of groups forever
|
|
||||||
Make great glorious MDI Client
|
|
||||||
RETURNS -
|
|
||||||
Zero if nothing, otherwise returns the good stuff.
|
|
||||||
\* * * */
|
|
||||||
|
|
||||||
/* * * *\
|
|
||||||
TempCreateGroup -
|
|
||||||
th
|
|
||||||
RETURNS -
|
|
||||||
handle to window
|
|
||||||
\* * * */
|
|
||||||
HWND TempCreateGroup(HWND hMDIClient)
|
|
||||||
{
|
|
||||||
MDICREATESTRUCT mcs;
|
|
||||||
HWND hChild;
|
|
||||||
|
|
||||||
mcs.szClass = szGrpClass;
|
|
||||||
mcs.szTitle = L"";
|
|
||||||
mcs.hOwner = hAppInstance;
|
|
||||||
mcs.x = mcs.y = mcs.cx = mcs.cy = CW_USEDEFAULT;
|
|
||||||
mcs.style = WS_VISIBLE;
|
|
||||||
|
|
||||||
hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LPARAM)(LPTSTR)&mcs);
|
|
||||||
// if (!hChild)
|
|
||||||
// {
|
|
||||||
// MessageBox(hMDIClient, L"MDI Child creation failed.", L"Oh Oh...",
|
|
||||||
// MB_ICONEXCLAMATION | MB_OK);
|
|
||||||
// }
|
|
||||||
return hChild;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -10,32 +10,36 @@
|
|||||||
/* Pragmas */
|
/* Pragmas */
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* Includes */
|
|
||||||
#include <wtypes.h>
|
|
||||||
|
|
||||||
/* Definitions */
|
/* Definitions */
|
||||||
#define MAX_GROUPS 512
|
#define MAX_GROUPS 512
|
||||||
#define MAX_ITEMS 512
|
#define MAX_ITEMS 512
|
||||||
#define MAX_TITLE_LENGTH MAX_PATH
|
#define MAX_TITLE_LENGTH MAX_PATH
|
||||||
// Group Format Definitions
|
// Group Format Definitions
|
||||||
#define GRP_SIGNATURE 0x47324D50L // PM2G
|
#define GRP_SIGNATURE 0x47324D50L // PM2G
|
||||||
|
#define GRP_VERSION 1 // Increment for breaking changes
|
||||||
// Group Flag Values (DWORD)
|
// Group Flag Values (DWORD)
|
||||||
#define GRP_FLAG_COMMON 0x00000001
|
#define GRP_FLAG_COMMON 0x00000001
|
||||||
#define GRP_FLAG_READONLY 0x00000002
|
#define GRP_FLAG_READONLY 0x00000002
|
||||||
#define GRP_FLAG_MINIMIZED 0x00000004
|
#define GRP_FLAG_MINIMIZED 0x00000004
|
||||||
#define GRP_FLAG_MAXIMIZED 0x00000008
|
#define GRP_FLAG_MAXIMIZED 0x00000008
|
||||||
|
// Item Flag Values (DWORD)
|
||||||
|
#define ITM_FLAG_MINIMIZED 0x00000001
|
||||||
|
#define ITM_FLAG_MAXIMIZED 0x00000002
|
||||||
|
|
||||||
/* Structures */
|
/* Structures */
|
||||||
// Item Structure
|
// Item Structure
|
||||||
typedef struct _ITEM {
|
typedef struct _ITEM {
|
||||||
// Item executable and name
|
// Item executable and name
|
||||||
WCHAR szItemName[MAX_TITLE_LENGTH];
|
WCHAR szName[MAX_TITLE_LENGTH];
|
||||||
WCHAR szExecPath[MAX_PATH]; // Path of the item executable
|
WCHAR szExecPath[MAX_PATH]; // Path of the executable
|
||||||
WCHAR szWorkPath[MAX_PATH]; // Working directory
|
WCHAR szWorkPath[MAX_PATH]; // Working directory
|
||||||
|
// Item flags
|
||||||
|
DWORD dwFlags; // Use with ITM_FLAG_* values.
|
||||||
|
UINT uiHotkeyModifiers;
|
||||||
|
UINT uiHotkeyVirtualKey;
|
||||||
// Icon
|
// Icon
|
||||||
WCHAR szIconPath[MAX_PATH]; // Path of the icon
|
WCHAR szIconPath[MAX_PATH];
|
||||||
UINT uiIconIndex; // Index of the icon
|
INT iIconIndex;
|
||||||
} ITEM, * PITEM;
|
} ITEM, * PITEM;
|
||||||
|
|
||||||
// Group format, .GRP
|
// Group format, .GRP
|
||||||
@@ -44,12 +48,15 @@ typedef struct _GROUP {
|
|||||||
DWORD dwSignature; // Set to GRP_SIGNATURE
|
DWORD dwSignature; // Set to GRP_SIGNATURE
|
||||||
WORD wVersion; // Group format version
|
WORD wVersion; // Group format version
|
||||||
WORD wChecksum;
|
WORD wChecksum;
|
||||||
|
|
||||||
// Group information
|
// Group information
|
||||||
WCHAR szGroupName[MAX_TITLE_LENGTH];
|
WCHAR szName[MAX_TITLE_LENGTH];
|
||||||
DWORD dwFlags; // Use with GRP_FLAG_* values.
|
DWORD dwFlags; // Use with GRP_FLAG_* values.
|
||||||
FILETIME ftLastWrite;
|
FILETIME ftLastWrite;
|
||||||
|
// Window information
|
||||||
|
RECT rcGroup;
|
||||||
|
// Icon
|
||||||
|
WCHAR szIconPath[MAX_PATH];
|
||||||
|
INT iIconIndex;
|
||||||
// Items
|
// Items
|
||||||
WORD cItems; // Number of items
|
WORD cItems; // Number of items
|
||||||
PITEM iItems; // Array of items
|
PITEM iItems; // Array of items
|
||||||
@@ -57,14 +64,25 @@ typedef struct _GROUP {
|
|||||||
|
|
||||||
// Group window information
|
// Group window information
|
||||||
typedef struct _GROUPWND {
|
typedef struct _GROUPWND {
|
||||||
// Window information
|
// Windows
|
||||||
HWND hWndGroup;
|
HWND hWndGroup;
|
||||||
RECT rcGroup; // Window rectangle
|
HWND hWndListView;
|
||||||
|
// Group
|
||||||
|
GROUP grp; // Pointer to GROUP structure
|
||||||
|
} GROUPWND, * PGROUPWND;
|
||||||
|
|
||||||
// Group information
|
/* Global Variables */
|
||||||
HANDLE hGroup; // Handle to GROUP object
|
extern HWND hWndMDIClient;
|
||||||
} GROUPINFO, * PGROUPINFO;
|
|
||||||
|
/* Local Variables */
|
||||||
|
|
||||||
/* Function Prototypes */
|
/* Function Prototypes */
|
||||||
|
BOOL InitializeGroups();
|
||||||
|
// Group Window
|
||||||
LRESULT CALLBACK GroupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
LRESULT CALLBACK GroupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
HWND TempCreateGroup(HWND hMDIClient);
|
PGROUPWND CreateGroupWindow(PGROUP pgGroup);
|
||||||
|
// Group information
|
||||||
|
BOOL SetGroupFlags(PGROUPWND pgw, DWORD dwFlags);
|
||||||
|
BOOL GetGroupFlags(PGROUPWND pgw, DWORD dwFlags);
|
||||||
|
// Import/export functions
|
||||||
|
GROUP SaveGroup(PGROUPWND pgw);
|
||||||
|
|||||||
38
progmgr/grpupdat.h
Normal file
38
progmgr/grpupdat.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/* * * * * * * *\
|
||||||
|
GRPUPDAT.H -
|
||||||
|
Copyright (c) 2023 freedom7341, Vortesys
|
||||||
|
DESCRIPTION -
|
||||||
|
Header containing classic program group structures
|
||||||
|
in order to facilitate conversion to the new format.
|
||||||
|
LICENSE INFORMATION -
|
||||||
|
MIT License, see LICENSE.txt in the root folder
|
||||||
|
\* * * * * * * */
|
||||||
|
|
||||||
|
/* Pragmas */
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* Includes */
|
||||||
|
#include <wtypes.h>
|
||||||
|
|
||||||
|
/* Definitions */
|
||||||
|
// Group signatures
|
||||||
|
#define OLDGRP_SIGNATURE 0x43554D50L // PMUC
|
||||||
|
|
||||||
|
/* Structures */
|
||||||
|
// Old group format, .GRP
|
||||||
|
typedef struct _OLDGROUP {
|
||||||
|
DWORD dwMagic; // Set to OLDGRP_SIGNATURE
|
||||||
|
WORD wCheckSum; // Seemingly unused
|
||||||
|
WORD cbGroup; // Size of group
|
||||||
|
RECT rcNormal; // Window rect
|
||||||
|
POINT ptMin; // Minimized window position
|
||||||
|
WORD nCmdShow; // Min/max state
|
||||||
|
WORD pName; // Group name
|
||||||
|
WORD cxIcon; // Icon width
|
||||||
|
WORD cyIcon; // Icon height
|
||||||
|
WORD wIconFormat;
|
||||||
|
WORD wReserved; // Unused
|
||||||
|
|
||||||
|
WORD cItems; // Number of items
|
||||||
|
WORD rgiItems[1]; // Array of item offsets
|
||||||
|
} OLDGROUP, * POLDGROUP;
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -19,18 +19,18 @@
|
|||||||
/* Variables */
|
/* Variables */
|
||||||
// Global
|
// Global
|
||||||
BOOL bIsDefaultShell = FALSE;
|
BOOL bIsDefaultShell = FALSE;
|
||||||
// Window Related
|
// Handles
|
||||||
|
HINSTANCE hAppInstance;
|
||||||
|
HANDLE hAppHeap;
|
||||||
|
HWND hWndProgMgr = NULL;
|
||||||
|
// Icons
|
||||||
HICON hProgMgrIcon = NULL;
|
HICON hProgMgrIcon = NULL;
|
||||||
HICON hGroupIcon = NULL;
|
HICON hGroupIcon = NULL;
|
||||||
HINSTANCE hAppInstance;
|
|
||||||
HWND hWndProgMgr = NULL;
|
|
||||||
HWND hWndMDIClient = NULL;
|
|
||||||
// Global Strings
|
// Global Strings
|
||||||
WCHAR szAppTitle[32];
|
WCHAR szAppTitle[32];
|
||||||
WCHAR szProgMgr[] = L"progmgr";
|
WCHAR szProgMgr[] = L"progmgr";
|
||||||
WCHAR szWebsite[64];
|
WCHAR szWebsite[64];
|
||||||
WCHAR szClass[16];
|
WCHAR szClass[16];
|
||||||
WCHAR szGrpClass[16];
|
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
|
|
||||||
@@ -45,16 +45,18 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
|||||||
HMENU hMenu;
|
HMENU hMenu;
|
||||||
HMENU hSystemMenu;
|
HMENU hSystemMenu;
|
||||||
WNDCLASS wc = { 0 };
|
WNDCLASS wc = { 0 };
|
||||||
WNDCLASSEX wce = { 0 };
|
|
||||||
WCHAR szBuffer[MAX_PATH];
|
WCHAR szBuffer[MAX_PATH];
|
||||||
RECT rcRoot;
|
RECT rcRoot;
|
||||||
POINT ptOffset;
|
POINT ptOffset;
|
||||||
|
|
||||||
|
// Initialize the instance
|
||||||
hAppInstance = hInstance;
|
hAppInstance = hInstance;
|
||||||
|
|
||||||
|
// Create our global heap handle
|
||||||
|
hAppHeap = GetProcessHeap();
|
||||||
|
|
||||||
// Create Strings
|
// Create Strings
|
||||||
LoadString(hAppInstance, IDS_PMCLASS, szClass, ARRAYSIZE(szClass));
|
LoadString(hAppInstance, IDS_PMCLASS, szClass, ARRAYSIZE(szClass));
|
||||||
LoadString(hAppInstance, IDS_GRPCLASS, szGrpClass, ARRAYSIZE(szGrpClass));
|
|
||||||
LoadString(hAppInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle));
|
LoadString(hAppInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle));
|
||||||
LoadString(hAppInstance, IDS_WEBSITE, szWebsite, ARRAYSIZE(szWebsite));
|
LoadString(hAppInstance, IDS_WEBSITE, szWebsite, ARRAYSIZE(szWebsite));
|
||||||
|
|
||||||
@@ -71,22 +73,8 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
|||||||
wc.hbrBackground = NULL;
|
wc.hbrBackground = NULL;
|
||||||
wc.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN);
|
wc.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN);
|
||||||
wc.lpszClassName = szClass;
|
wc.lpszClassName = szClass;
|
||||||
if (!RegisterClass(&wc))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
// Register the Group Window Class
|
if (!RegisterClass(&wc))
|
||||||
wce.cbSize = sizeof(WNDCLASSEX);
|
|
||||||
wce.lpfnWndProc = GroupWndProc;
|
|
||||||
wce.cbClsExtra = 0;
|
|
||||||
wce.cbWndExtra = 0;
|
|
||||||
wce.hInstance = hAppInstance;
|
|
||||||
wce.hIcon = hGroupIcon = LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_PROGGRP), IMAGE_ICON,
|
|
||||||
0, 0, LR_DEFAULTSIZE | LR_SHARED);
|
|
||||||
wce.hCursor = LoadCursor(NULL, IDC_ARROW);
|
|
||||||
wce.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
|
||||||
wce.lpszMenuName = NULL;
|
|
||||||
wce.lpszClassName = szGrpClass;
|
|
||||||
if (!RegisterClassEx(&wce))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Load the Accelerator table
|
// Load the Accelerator table
|
||||||
@@ -95,15 +83,14 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Perform Registry actions, close if registry is inaccessible.
|
// Perform Registry actions, close if registry is inaccessible.
|
||||||
if (InitializeRegistryKeys())
|
if (!InitializeRegistryKeys())
|
||||||
{
|
return FALSE;
|
||||||
bIsDefaultShell = IsProgMgrDefaultShell();
|
|
||||||
LoadConfig();
|
bIsDefaultShell = IsProgMgrDefaultShell();
|
||||||
}
|
|
||||||
else
|
// Load configuration, but don't load groups yet
|
||||||
{
|
if(LoadConfig(TRUE, TRUE, FALSE) != RCE_SUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
// Get size of the root HWND
|
// Get size of the root HWND
|
||||||
GetWindowRect(GetDesktopWindow(), &rcRoot);
|
GetWindowRect(GetDesktopWindow(), &rcRoot);
|
||||||
@@ -113,11 +100,11 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
|||||||
SystemParametersInfo(SPI_ICONVERTICALSPACING, 0, &ptOffset.y, 0);
|
SystemParametersInfo(SPI_ICONVERTICALSPACING, 0, &ptOffset.y, 0);
|
||||||
|
|
||||||
// Create main window with a default size
|
// Create main window with a default size
|
||||||
// NOTE: i pulled 320x240 out of my ass, make this dynamic later
|
// TODO: i pulled 320x240 out of my ass, make this dynamic later
|
||||||
if (!CreateWindow(wc.lpszClassName, szAppTitle, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
if (!(hWndProgMgr = CreateWindowW(wc.lpszClassName, szAppTitle, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||||
rcRoot.left + ptOffset.x, rcRoot.top + ptOffset.y,
|
rcRoot.left + ptOffset.x, rcRoot.top + ptOffset.y,
|
||||||
rcRoot.left + ptOffset.x + 320, rcRoot.top + ptOffset.y + 240,
|
rcRoot.left + ptOffset.x + 320, rcRoot.top + ptOffset.y + 240,
|
||||||
0, 0, hAppInstance, NULL))
|
0, 0, hAppInstance, NULL)))
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
// Set the window size from the registry, but only if the coords make sense
|
// Set the window size from the registry, but only if the coords make sense
|
||||||
@@ -163,6 +150,10 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
|||||||
// CreateDesktopWindow();
|
// CreateDesktopWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the frame window
|
||||||
|
if (!InitializeGroups())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
while (GetMessage(&msg, NULL, 0, 0) > 0)
|
while (GetMessage(&msg, NULL, 0, 0) > 0)
|
||||||
{
|
{
|
||||||
if (!TranslateMDISysAccel(hWndMDIClient, &msg) &&
|
if (!TranslateMDISysAccel(hWndMDIClient, &msg) &&
|
||||||
|
|||||||
@@ -29,18 +29,19 @@
|
|||||||
#define RF_RETRY 0x0002 // Cancel the operation, but leave the dialog open
|
#define RF_RETRY 0x0002 // Cancel the operation, but leave the dialog open
|
||||||
|
|
||||||
/* Global Variables */
|
/* Global Variables */
|
||||||
// PROGMGR.C
|
|
||||||
extern BOOL bIsDefaultShell;
|
extern BOOL bIsDefaultShell;
|
||||||
|
// Handles
|
||||||
|
extern HINSTANCE hAppInstance;
|
||||||
|
extern HANDLE hAppHeap;
|
||||||
|
extern HWND hWndProgMgr;
|
||||||
|
// Icons
|
||||||
extern HICON hProgMgrIcon;
|
extern HICON hProgMgrIcon;
|
||||||
extern HICON hGroupIcon;
|
extern HICON hGroupIcon;
|
||||||
extern HINSTANCE hAppInstance;
|
// Strings
|
||||||
extern HWND hWndProgMgr;
|
|
||||||
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];
|
||||||
extern WCHAR szClass[16];
|
extern WCHAR szClass[16];
|
||||||
extern WCHAR szGrpClass[16];
|
|
||||||
|
|
||||||
/* Function Prototypes */
|
/* Function Prototypes */
|
||||||
// DESKTOP.C
|
// DESKTOP.C
|
||||||
|
|||||||
@@ -159,13 +159,16 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="dialog.h" />
|
||||||
<ClInclude Include="group.h" />
|
<ClInclude Include="group.h" />
|
||||||
|
<ClInclude Include="grpupdat.h" />
|
||||||
<ClInclude Include="progmgr.h" />
|
<ClInclude Include="progmgr.h" />
|
||||||
<ClInclude Include="registry.h" />
|
<ClInclude Include="registry.h" />
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="desktop.c" />
|
<ClCompile Include="desktop.c" />
|
||||||
|
<ClCompile Include="dialog.c" />
|
||||||
<ClCompile Include="progmgr.c" />
|
<ClCompile Include="progmgr.c" />
|
||||||
<ClCompile Include="registry.c" />
|
<ClCompile Include="registry.c" />
|
||||||
<ClCompile Include="group.c" />
|
<ClCompile Include="group.c" />
|
||||||
|
|||||||
@@ -30,6 +30,12 @@
|
|||||||
<ClInclude Include="group.h">
|
<ClInclude Include="group.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="grpupdat.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="dialog.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="progmgr.c">
|
<ClCompile Include="progmgr.c">
|
||||||
@@ -50,6 +56,9 @@
|
|||||||
<ClCompile Include="group.c">
|
<ClCompile Include="group.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="dialog.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="resource.rc">
|
<ResourceCompile Include="resource.rc">
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
/* Headers */
|
/* Headers */
|
||||||
#include "progmgr.h"
|
#include "progmgr.h"
|
||||||
|
#include "group.h"
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
// #define WIN32_LEAN_AND_MEAN
|
// #define WIN32_LEAN_AND_MEAN
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
@@ -110,24 +111,67 @@ BOOL IsProgMgrDefaultShell()
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
SaveGroupToRegistry -
|
||||||
|
Saves a group structure to registry.
|
||||||
|
RETURNS -
|
||||||
|
RCE_* configuration error value
|
||||||
|
\* * * */
|
||||||
|
DWORD SaveGroupToRegistry(_In_ PGROUP pg)
|
||||||
|
{
|
||||||
|
DWORD dwConfigStatus = RCE_SUCCESS;
|
||||||
|
|
||||||
|
// If the pointer is invalid then fail out
|
||||||
|
if (pg == NULL)
|
||||||
|
return RCE_FAILURE;
|
||||||
|
|
||||||
|
// Save group
|
||||||
|
if (!RegSetValueEx(hKeyProgramGroups, pg->szName, 0, REG_BINARY,
|
||||||
|
(const BYTE*)pg, (sizeof(*pg) + sizeof(ITEM) * pg->cItems)) == ERROR_SUCCESS)
|
||||||
|
dwConfigStatus = dwConfigStatus && RCE_GROUPS;
|
||||||
|
|
||||||
|
return dwConfigStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
LoadGroupFromRegistry -
|
||||||
|
Loads a group structure from the registry.
|
||||||
|
RETURNS -
|
||||||
|
RCE_* configuration error value
|
||||||
|
\* * * */
|
||||||
|
DWORD LoadGroupFromRegistry(_Inout_ PGROUP pg, _Out_ DWORD dwBufferSize)
|
||||||
|
{
|
||||||
|
DWORD dwConfigStatus = RCE_SUCCESS;
|
||||||
|
DWORD dwType = REG_BINARY;
|
||||||
|
|
||||||
|
// If the pointer is invalid then fail out
|
||||||
|
if (pg == NULL)
|
||||||
|
return RCE_FAILURE;
|
||||||
|
|
||||||
|
// Load group
|
||||||
|
if (!RegQueryValueEx(hKeyProgramGroups, pg->szName, 0, &dwType,
|
||||||
|
(LPBYTE)pg, &dwBufferSize) == ERROR_SUCCESS)
|
||||||
|
dwConfigStatus = dwConfigStatus && RCE_POSITION;
|
||||||
|
|
||||||
|
return dwConfigStatus;
|
||||||
|
}
|
||||||
|
|
||||||
/* * * *\
|
/* * * *\
|
||||||
SaveConfig -
|
SaveConfig -
|
||||||
Finds and collapses all settings
|
Finds and collapses all settings
|
||||||
and saves them to the registry.
|
and saves them to the registry.
|
||||||
RETURNS -
|
RETURNS -
|
||||||
TRUE if successful, FALSE if unsuccessful.
|
RCE_* configuration error value
|
||||||
\* * * */
|
\* * * */
|
||||||
BOOL SaveConfig(BOOL bPos, BOOL bSettings, BOOL bGroups)
|
DWORD SaveConfig(BOOL bSettings, BOOL bPos, BOOL bGroups)
|
||||||
{
|
{
|
||||||
BOOL bConfigStatus = TRUE;
|
DWORD dwConfigStatus = RCE_SUCCESS;
|
||||||
WINDOWPLACEMENT wpProgMgr;
|
|
||||||
RECT rcWindow;
|
|
||||||
|
|
||||||
if (bSettings)
|
if (bSettings)
|
||||||
{
|
{
|
||||||
// Shrink the settings into the bitmask and save it
|
// Shrink the settings into the bitmask and save it
|
||||||
// There's definitely a better way to do this but...
|
// There's definitely a better way to do this but...
|
||||||
// I'll get to it later :)
|
// TODO: do this more efficiently
|
||||||
dwSettingsMask =
|
dwSettingsMask =
|
||||||
(bAutoArrange && PMS_AUTOARRANGE) * PMS_AUTOARRANGE |
|
(bAutoArrange && PMS_AUTOARRANGE) * PMS_AUTOARRANGE |
|
||||||
(bMinOnRun && PMS_MINONRUN) * PMS_MINONRUN |
|
(bMinOnRun && PMS_MINONRUN) * PMS_MINONRUN |
|
||||||
@@ -137,11 +181,14 @@ BOOL SaveConfig(BOOL bPos, BOOL bSettings, BOOL bGroups)
|
|||||||
|
|
||||||
if (!RegSetValueEx(hKeySettings, pszSettingsMask, 0, REG_DWORD,
|
if (!RegSetValueEx(hKeySettings, pszSettingsMask, 0, REG_DWORD,
|
||||||
(const BYTE*)&dwSettingsMask, sizeof(dwSettingsMask)) == ERROR_SUCCESS)
|
(const BYTE*)&dwSettingsMask, sizeof(dwSettingsMask)) == ERROR_SUCCESS)
|
||||||
bConfigStatus = FALSE;
|
dwConfigStatus = dwConfigStatus && RCE_SETTINGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPos)
|
if (bPos)
|
||||||
{
|
{
|
||||||
|
WINDOWPLACEMENT wpProgMgr;
|
||||||
|
RECT rcWindow;
|
||||||
|
|
||||||
// Get and save window position
|
// Get and save window position
|
||||||
wpProgMgr.length = sizeof(WINDOWPLACEMENT);
|
wpProgMgr.length = sizeof(WINDOWPLACEMENT);
|
||||||
GetWindowPlacement(hWndProgMgr, &wpProgMgr);
|
GetWindowPlacement(hWndProgMgr, &wpProgMgr);
|
||||||
@@ -149,30 +196,40 @@ BOOL SaveConfig(BOOL bPos, BOOL bSettings, BOOL bGroups)
|
|||||||
|
|
||||||
if (!RegSetValueEx(hKeySettings, pszSettingsWindow, 0, REG_BINARY,
|
if (!RegSetValueEx(hKeySettings, pszSettingsWindow, 0, REG_BINARY,
|
||||||
(const BYTE*)&rcWindow, sizeof(rcWindow)) == ERROR_SUCCESS)
|
(const BYTE*)&rcWindow, sizeof(rcWindow)) == ERROR_SUCCESS)
|
||||||
bConfigStatus = FALSE;
|
dwConfigStatus = dwConfigStatus && RCE_POSITION;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bConfigStatus;
|
if (bGroups)
|
||||||
|
{
|
||||||
|
// TODO: Get list of groups, iterate through,
|
||||||
|
// save each one as an individual subkey based
|
||||||
|
// on the name of the group
|
||||||
|
dwConfigStatus = dwConfigStatus && RCE_GROUPS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwConfigStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* * * *\
|
/* * * *\
|
||||||
BOOL LoadConfig() -
|
LoadConfig() -
|
||||||
Finds all settings and retrieves them
|
Finds all settings and retrieves them
|
||||||
from the registry.
|
from the registry.
|
||||||
RETURNS -
|
RETURNS -
|
||||||
TRUE if successful, FALSE if unsuccessful.
|
RCE_* configuration error value
|
||||||
\* * * */
|
\* * * */
|
||||||
BOOL LoadConfig()
|
DWORD LoadConfig(BOOL bSettings, BOOL bPos, BOOL bGroups)
|
||||||
|
{
|
||||||
|
DWORD dwConfigStatus = RCE_SUCCESS;
|
||||||
|
|
||||||
|
if (bSettings)
|
||||||
{
|
{
|
||||||
BOOL bConfigStatus = TRUE;
|
|
||||||
DWORD dwType;
|
|
||||||
DWORD dwBufferSize = sizeof(dwSettingsMask);
|
DWORD dwBufferSize = sizeof(dwSettingsMask);
|
||||||
DWORD dwRectBufferSize = sizeof(rcMainWindow);
|
DWORD dwType = REG_DWORD;
|
||||||
|
|
||||||
// Load settings bitmask
|
// Load settings bitmask
|
||||||
if (!RegQueryValueEx(hKeySettings, pszSettingsMask, 0, &dwType,
|
if (!RegQueryValueEx(hKeySettings, pszSettingsMask, 0, &dwType,
|
||||||
(LPBYTE)&dwSettingsMask, &dwBufferSize) == ERROR_SUCCESS)
|
(LPBYTE)&dwSettingsMask, &dwBufferSize) == ERROR_SUCCESS)
|
||||||
bConfigStatus = FALSE;
|
dwConfigStatus = dwConfigStatus && RCE_SETTINGS;
|
||||||
|
|
||||||
// Apply bitmask to booleans
|
// Apply bitmask to booleans
|
||||||
bAutoArrange = (dwSettingsMask & PMS_AUTOARRANGE);
|
bAutoArrange = (dwSettingsMask & PMS_AUTOARRANGE);
|
||||||
@@ -180,11 +237,24 @@ BOOL LoadConfig()
|
|||||||
bTopMost = (dwSettingsMask & PMS_TOPMOST);
|
bTopMost = (dwSettingsMask & PMS_TOPMOST);
|
||||||
bSaveSettings = (dwSettingsMask & PMS_SAVESETTINGS);
|
bSaveSettings = (dwSettingsMask & PMS_SAVESETTINGS);
|
||||||
bShowUsername = (dwSettingsMask & PMS_SHOWUSERNAME);
|
bShowUsername = (dwSettingsMask & PMS_SHOWUSERNAME);
|
||||||
|
}
|
||||||
|
|
||||||
// Load window position... and apply it!
|
if (bPos)
|
||||||
|
{
|
||||||
|
DWORD dwRectBufferSize = sizeof(rcMainWindow);
|
||||||
|
DWORD dwType = REG_BINARY;
|
||||||
|
|
||||||
|
// Load window position
|
||||||
if (!RegQueryValueEx(hKeySettings, pszSettingsWindow, 0, &dwType,
|
if (!RegQueryValueEx(hKeySettings, pszSettingsWindow, 0, &dwType,
|
||||||
(LPBYTE)&rcMainWindow, &dwRectBufferSize) == ERROR_SUCCESS)
|
(LPBYTE)&rcMainWindow, &dwRectBufferSize) == ERROR_SUCCESS)
|
||||||
bConfigStatus = FALSE;
|
dwConfigStatus = dwConfigStatus && RCE_POSITION;
|
||||||
|
}
|
||||||
return bConfigStatus;
|
|
||||||
|
if (bGroups)
|
||||||
|
{
|
||||||
|
// TODO: this is unbearable
|
||||||
|
dwConfigStatus = dwConfigStatus && RCE_GROUPS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwConfigStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,13 @@
|
|||||||
// #define PROGMAN_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Program Manager"
|
// #define PROGMAN_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Program Manager"
|
||||||
// #define WINDOWS_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"
|
// #define WINDOWS_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"
|
||||||
#define PROGMGR_KEY L"Software\\Vortesys\\Program Manager II"
|
#define PROGMGR_KEY L"Software\\Vortesys\\Program Manager II"
|
||||||
// Settings Bitmask Values (DWORD)
|
// Registry configuration error values (DWORD)
|
||||||
|
#define RCE_SUCCESS 0x0000000
|
||||||
|
#define RCE_FAILURE 0x0000001
|
||||||
|
#define RCE_SETTINGS 0x0000002
|
||||||
|
#define RCE_POSITION 0x0000004
|
||||||
|
#define RCE_GROUPS 0x0000008
|
||||||
|
// Settings values (DWORD)
|
||||||
#define PMS_AUTOARRANGE 0x00000001
|
#define PMS_AUTOARRANGE 0x00000001
|
||||||
#define PMS_MINONRUN 0x00000002
|
#define PMS_MINONRUN 0x00000002
|
||||||
#define PMS_TOPMOST 0x00000004
|
#define PMS_TOPMOST 0x00000004
|
||||||
@@ -43,5 +49,9 @@ extern RECT rcMainWindow;
|
|||||||
/* Function Prototypes */
|
/* Function Prototypes */
|
||||||
BOOL InitializeRegistryKeys(VOID);
|
BOOL InitializeRegistryKeys(VOID);
|
||||||
BOOL IsProgMgrDefaultShell(VOID);
|
BOOL IsProgMgrDefaultShell(VOID);
|
||||||
BOOL LoadConfig(VOID);
|
// Groups
|
||||||
BOOL SaveConfig(BOOL bPos, BOOL bSettings, BOOL bGroups);
|
DWORD SaveGroupToRegistry(_In_ PGROUP pg);
|
||||||
|
DWORD LoadGroupFromRegistry(_Inout_ PGROUP pg, _Out_ DWORD dwBufferSize);
|
||||||
|
// Settings
|
||||||
|
DWORD SaveConfig(BOOL bSettings, BOOL bPos, BOOL bGroups);
|
||||||
|
DWORD LoadConfig(BOOL bSettings, BOOL bPos, BOOL bGroups);
|
||||||
|
|||||||
Binary file not shown.
@@ -17,6 +17,7 @@
|
|||||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
#pragma code_page(65001) // UTF-8
|
#pragma code_page(65001) // UTF-8
|
||||||
#include "lang\res_en-US.rc" // English (US)
|
#include "lang\res_en-US.rc" // English (US)
|
||||||
|
#include "lang\dlg_en-US.rc" // English (US)
|
||||||
|
|
||||||
/* Icon Library */
|
/* Icon Library */
|
||||||
// Primary
|
// Primary
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
/* Headers */
|
/* Headers */
|
||||||
#include "progmgr.h"
|
#include "progmgr.h"
|
||||||
|
#include "dialog.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
@@ -31,36 +32,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
|
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
CLIENTCREATESTRUCT ccs;
|
|
||||||
RECT rc;
|
|
||||||
|
|
||||||
// Frame Window
|
|
||||||
hWndProgMgr = hWnd;
|
|
||||||
|
|
||||||
// Create the MDI Client Window
|
|
||||||
ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), IDM_WINDOW);
|
|
||||||
ccs.idFirstChild = IDM_WINDOW_CHILDSTART;
|
|
||||||
|
|
||||||
GetClientRect(hWndProgMgr, &rc);
|
|
||||||
|
|
||||||
if (!(hWndMDIClient = CreateWindowEx(WS_EX_COMPOSITED, L"MDIClient",
|
|
||||||
NULL, WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,
|
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
|
||||||
hWnd, (HMENU)1, hAppInstance, (LPWSTR)&ccs)))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
TempCreateGroup(hWndMDIClient);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
{
|
{
|
||||||
if ((wParam >= IDM_MAIN) || (wParam <= IDM_TASKMGR))
|
if ((wParam >= IDM_MAIN) && (wParam <= IDM_TASKMGR))
|
||||||
{
|
{
|
||||||
if (wParam == IDM_TASKMGR)
|
if (wParam == IDM_TASKMGR)
|
||||||
{
|
{
|
||||||
@@ -118,6 +98,14 @@ LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
ExitWindowsDialog(hWnd);
|
ExitWindowsDialog(hWnd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDM_FILE_NEW_GROUP:
|
||||||
|
DialogBox(hAppInstance, MAKEINTRESOURCE(DLG_GROUP), hWnd, (DLGPROC)NewGroupDlgProc);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDM_FILE_NEW_ITEM:
|
||||||
|
DialogBox(hAppInstance, MAKEINTRESOURCE(DLG_ITEM), hWnd, (DLGPROC)NewItemDlgProc);
|
||||||
|
break;
|
||||||
|
|
||||||
case IDM_FILE_RUN:
|
case IDM_FILE_RUN:
|
||||||
RunFileDlg(hWnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY);
|
RunFileDlg(hWnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY);
|
||||||
break;
|
break;
|
||||||
|
|||||||
3
zipbuild.bat
Normal file
3
zipbuild.bat
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
del /s "%~dp0\*.zip"
|
||||||
|
7z a -r "%~dp0\bin.zip" "%~dp0bin\*.exe"
|
||||||
|
pause
|
||||||
Reference in New Issue
Block a user