vista+ compatibility part 1

This commit is contained in:
Brady McDermott
2023-10-21 13:40:47 -06:00
parent e7bcb43cd1
commit 000ecc527f
3 changed files with 12 additions and 22 deletions

View File

@@ -132,7 +132,6 @@ LRESULT CALLBACK DeskWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
break; break;
case WM_ACTIVATE: case WM_ACTIVATE:
case WM_DPICHANGED:
case WM_DISPLAYCHANGE: case WM_DISPLAYCHANGE:
case WM_DEVICECHANGE: case WM_DEVICECHANGE:
// Get size of the root HWND // Get size of the root HWND

View File

@@ -15,7 +15,7 @@
#include "resource.h" #include "resource.h"
// #define WIN32_LEAN_AND_MEAN // #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
#include <pathcch.h> #include <Commctrl.h>
#include <Shlobj.h> #include <Shlobj.h>
#include <shlwapi.h> #include <shlwapi.h>
#include <strsafe.h> #include <strsafe.h>

View File

@@ -239,6 +239,7 @@ PITEM CreateItem(_In_ HWND hWndGroup, _In_ PITEM pi)
HICON hIcon = NULL; HICON hIcon = NULL;
LVITEM lvi = { 0 }; LVITEM lvi = { 0 };
PGROUP pGroup = NULL; PGROUP pGroup = NULL;
PGROUP pNewGroup = NULL;
PITEM pItem = NULL; PITEM pItem = NULL;
UINT uiTest = 0; UINT uiTest = 0;
HWND hWndListView = NULL; HWND hWndListView = NULL;
@@ -260,16 +261,12 @@ PITEM CreateItem(_In_ HWND hWndGroup, _In_ PITEM pi)
if (hWndListView == NULL) if (hWndListView == NULL)
return NULL; return NULL;
// compare group's existing memory to needed memory // if we reallocate memory then send the new pointer in
// if needed, reallocate the group's memory pNewGroup = realloc(pGroup, CalculateGroupMemory(pGroup, 1));
if (_msize(pGroup) != CalculateGroupMemory(pGroup, 1)) if (pNewGroup != NULL)
{ {
// if we reallocate memory then send the new pointer in pGroup = pNewGroup;
PGROUP pNewGroup = realloc(pGroup, CalculateGroupMemory(pGroup, 1)); SetWindowLongPtr(hWndGroup, GWLP_USERDATA, (LONG_PTR)pGroup);
if (pNewGroup != NULL) {
pGroup = pNewGroup;
SetWindowLongPtr(hWndGroup, GWLP_USERDATA, (LONG_PTR)pGroup);
}
} }
// add the item // add the item
@@ -356,21 +353,15 @@ BOOL ExecuteItem(_In_ PITEM pi)
\* * * */ \* * * */
VOID UpdateGroup(_In_ PGROUP pg) VOID UpdateGroup(_In_ PGROUP pg)
{ {
GROUP grp = { // Set the important flags
.dwSignature = GRP_SIGNATURE, pg->dwSignature = GRP_SIGNATURE;
.wVersion = GRP_VERSION, pg->wVersion = GRP_VERSION;
.wChecksum = 0,
.szName = TEXT(""),
.dwFlags = 0,
.ftLastWrite = 0,
.cItemArray = 0,
.pItemArray = 0
};
// Set the group checksum // Set the group checksum
pg->wChecksum = 1; // NOTE: implement this for real later lol pg->wChecksum = 1; // NOTE: implement this for real later lol
// TODO: set group flags // TODO: set name and group flags
// pg->szName = GetWindowText(blah blah blah);
// pg->dwFlags = GRP_FLAG_MAXIMIZED;// GetGroupFlags(pgw); // pg->dwFlags = GRP_FLAG_MAXIMIZED;// GetGroupFlags(pgw);
// Set FILETIME // Set FILETIME