use pointers instead :D
This commit is contained in:
@@ -146,7 +146,7 @@ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM
|
|||||||
grp.rcGroup.left = grp.rcGroup.top = grp.rcGroup.right = grp.rcGroup.bottom = CW_USEDEFAULT;
|
grp.rcGroup.left = grp.rcGroup.top = grp.rcGroup.right = grp.rcGroup.bottom = CW_USEDEFAULT;
|
||||||
|
|
||||||
// Group's ready!
|
// Group's ready!
|
||||||
if (CreateGroup(grp) != NULL)
|
if (CreateGroup(&grp) != NULL)
|
||||||
{
|
{
|
||||||
EndDialog(hWndDlg, FALSE);
|
EndDialog(hWndDlg, FALSE);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ BOOL InitializeGroups(VOID)
|
|||||||
Handle to the new group window
|
Handle to the new group window
|
||||||
or NULL on failure
|
or NULL on failure
|
||||||
\* * * */
|
\* * * */
|
||||||
HWND CreateGroup(_In_ GROUP grp)
|
HWND CreateGroup(_In_ PGROUP pgrp)
|
||||||
{
|
{
|
||||||
MDICREATESTRUCT mcs = { NULL };
|
MDICREATESTRUCT mcs = { NULL };
|
||||||
HICON hIconLarge = NULL;
|
HICON hIconLarge = NULL;
|
||||||
@@ -93,30 +93,27 @@ HWND CreateGroup(_In_ GROUP grp)
|
|||||||
HWND hWndListView = NULL;
|
HWND hWndListView = NULL;
|
||||||
PGROUP pGroup = NULL;
|
PGROUP pGroup = NULL;
|
||||||
|
|
||||||
// TODO: allocate memory for the group in the array
|
if (pgrp == NULL)
|
||||||
// of group pointers in PGARRAY, then pass this to
|
return NULL;
|
||||||
// the group window in that little pointer thing :D
|
|
||||||
// Unless... this just works a different way and I don't have to
|
// allocate memory for a new group
|
||||||
// keep track of all these stupid little pointers... since I can
|
pGroup = (PGROUP)malloc(CalculateGroupMemory(pgrp, 0));
|
||||||
// just associate this with the appropriate window.
|
|
||||||
// calculate necessary group memory and create it
|
|
||||||
pGroup = (PGROUP)malloc(CalculateGroupMemory(&grp, 0));
|
|
||||||
|
|
||||||
// Get group minimized/maximized flags
|
// Get group minimized/maximized flags
|
||||||
|
|
||||||
mcs.szClass = szGrpClass;
|
mcs.szClass = szGrpClass;
|
||||||
mcs.szTitle = grp.szName;
|
mcs.szTitle = pgrp->szName;
|
||||||
mcs.hOwner = hAppInstance;
|
mcs.hOwner = hAppInstance;
|
||||||
if ((grp.rcGroup.left == CW_USEDEFAULT) & (grp.rcGroup.right == CW_USEDEFAULT))
|
if ((pgrp->rcGroup.left == CW_USEDEFAULT) & (pgrp->rcGroup.right == CW_USEDEFAULT))
|
||||||
{
|
{
|
||||||
mcs.x = mcs.y = mcs.cx = mcs.cy = CW_USEDEFAULT;
|
mcs.x = mcs.y = mcs.cx = mcs.cy = CW_USEDEFAULT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mcs.x = grp.rcGroup.left;
|
mcs.x = pgrp->rcGroup.left;
|
||||||
mcs.y = grp.rcGroup.top;
|
mcs.y = pgrp->rcGroup.top;
|
||||||
mcs.cx = grp.rcGroup.right - grp.rcGroup.left;
|
mcs.cx = pgrp->rcGroup.right - pgrp->rcGroup.left;
|
||||||
mcs.cy = grp.rcGroup.bottom - grp.rcGroup.top;
|
mcs.cy = pgrp->rcGroup.bottom - pgrp->rcGroup.top;
|
||||||
}
|
}
|
||||||
mcs.style = WS_VISIBLE;
|
mcs.style = WS_VISIBLE;
|
||||||
// TODO: should I pass the pointer to the group through here
|
// TODO: should I pass the pointer to the group through here
|
||||||
@@ -130,7 +127,7 @@ HWND CreateGroup(_In_ GROUP grp)
|
|||||||
SetWindowLongPtr(hWndGroup, GWLP_USERDATA, (LONG_PTR)pGroup);
|
SetWindowLongPtr(hWndGroup, GWLP_USERDATA, (LONG_PTR)pGroup);
|
||||||
|
|
||||||
// Load the group icon
|
// Load the group icon
|
||||||
if (ExtractIconEx(grp.szIconPath, grp.iIconIndex, &hIconLarge, &hIconSmall, 1))
|
if (ExtractIconEx(pgrp->szIconPath, pgrp->iIconIndex, &hIconLarge, &hIconSmall, 1))
|
||||||
{
|
{
|
||||||
if (hIconTemp = (HICON)SendMessage(hWndGroup, WM_SETICON, ICON_SMALL, (LPARAM)hIconSmall))
|
if (hIconTemp = (HICON)SendMessage(hWndGroup, WM_SETICON, ICON_SMALL, (LPARAM)hIconSmall))
|
||||||
DestroyIcon(hIconTemp);
|
DestroyIcon(hIconTemp);
|
||||||
@@ -164,10 +161,6 @@ BOOL RemoveGroup(_In_ HWND hWndGroup, _In_ BOOL bEliminate)
|
|||||||
PGROUP pGroup = NULL;
|
PGROUP pGroup = NULL;
|
||||||
BOOL bReturn = TRUE;
|
BOOL bReturn = TRUE;
|
||||||
|
|
||||||
// TODO: do I handle group deletion from registry in here as well?
|
|
||||||
// should group deletion be "abstracted" here or should i handle windows
|
|
||||||
// and groups separately?
|
|
||||||
|
|
||||||
// TODO: do i have to delete the titlebar icons?
|
// TODO: do i have to delete the titlebar icons?
|
||||||
|
|
||||||
if (bEliminate == TRUE)
|
if (bEliminate == TRUE)
|
||||||
@@ -229,6 +222,8 @@ GROUP SaveGroup(_In_ PGROUP pg)
|
|||||||
|
|
||||||
grp.dwFlags = GRP_FLAG_MAXIMIZED;// GetGroupFlags(pgw);
|
grp.dwFlags = GRP_FLAG_MAXIMIZED;// GetGroupFlags(pgw);
|
||||||
|
|
||||||
|
|
||||||
|
// Set FILETIME
|
||||||
GetSystemTimeAsFileTime(&grp.ftLastWrite);
|
GetSystemTimeAsFileTime(&grp.ftLastWrite);
|
||||||
|
|
||||||
// Save items...
|
// Save items...
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ extern HWND hWndMDIClient;
|
|||||||
/* Function Prototypes */
|
/* Function Prototypes */
|
||||||
BOOL InitializeGroups(VOID);
|
BOOL InitializeGroups(VOID);
|
||||||
// Group Management
|
// Group Management
|
||||||
HWND CreateGroup(_In_ GROUP grp);
|
HWND CreateGroup(_In_ PGROUP pgrp);
|
||||||
BOOL RemoveGroup(_In_ HWND hWndGroup, _In_ BOOL bEliminate);
|
BOOL RemoveGroup(_In_ HWND hWndGroup, _In_ BOOL bEliminate);
|
||||||
// Import/export functions
|
// Import/export functions
|
||||||
GROUP SaveGroup(_In_ PGROUP pg);
|
GROUP SaveGroup(_In_ PGROUP pg);
|
||||||
|
|||||||
Reference in New Issue
Block a user