25
25
WNDCLASSEX wcGrp ;
26
26
WCHAR szGrpClass [16 ];
27
27
HWND hWndMDIClient = NULL ;
28
+ HWND hWndFoundGroup = NULL ;
28
29
29
30
/* Functions */
30
31
@@ -138,13 +139,6 @@ HWND CreateGroup(_In_ PGROUP pg)
138
139
{
139
140
mcs .x = mcs .y = mcs .cx = mcs .cy = CW_USEDEFAULT ;
140
141
}
141
- else
142
- {
143
- mcs .x = pg -> rcGroup .left ;
144
- mcs .y = pg -> rcGroup .top ;
145
- mcs .cx = pg -> rcGroup .right - pg -> rcGroup .left ;
146
- mcs .cy = pg -> rcGroup .bottom - pg -> rcGroup .top ;
147
- }
148
142
mcs .style = WS_VISIBLE | WS_THICKFRAME | WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX ;
149
143
// TODO: should I pass the pointer to the group through here
150
144
// or is it better and easier to just do it with GWLP_USERDATA?
@@ -157,6 +151,10 @@ HWND CreateGroup(_In_ PGROUP pg)
157
151
// Associate the group structure pointer to the group window
158
152
SetWindowLongPtr (hWndGroup , GWLP_USERDATA , (LONG_PTR )pGroup );
159
153
154
+ // Resize the group
155
+ if (pg -> wp .length == sizeof (WINDOWPLACEMENT ))
156
+ SetWindowPlacement (hWndGroup , & pg -> wp );
157
+
160
158
// Load the group icon
161
159
if (ExtractIconEx (pg -> szIconPath , pg -> iIconIndex , & hIconLarge , & hIconSmall , 1 ))
162
160
{
@@ -444,6 +442,8 @@ BOOL ExecuteItem(_In_ PITEM pi)
444
442
VOID UpdateGroup (_In_ PGROUP pg )
445
443
{
446
444
DWORD dwFlags = 0 ;
445
+ HWND hWndGroup = NULL ;
446
+
447
447
// Set the important flags
448
448
pg -> dwSignature = GRP_SIGNATURE ;
449
449
pg -> wVersion = GRP_VERSION ;
@@ -452,18 +452,55 @@ VOID UpdateGroup(_In_ PGROUP pg)
452
452
pg -> wChecksum = 1 ; // NOTE: implement this for real later lol
453
453
454
454
// TODO: set name and group flags
455
- // pg->szName = GetWindowText(blah blah blah);
456
455
// pg->dwFlags = GRP_FLAG_MAXIMIZED;// GetGroupFlags(pgw);
457
456
458
457
// Set FILETIME
459
458
GetSystemTimeAsFileTime (& pg -> ftLastWrite );
460
459
461
- // Get the group window rect
462
- // GetClientRect(hWndGroup, &rcGroupWindow);
460
+ if (hWndGroup = GetHwndFromPGroup (pg ))
461
+ {
462
+ // Get the group window rect and name
463
+ pg -> wp .length = sizeof (WINDOWPLACEMENT );
464
+ GetWindowPlacement (hWndGroup , & pg -> wp );
465
+ GetWindowText (hWndGroup , pg -> szName , ARRAYSIZE (pg -> szName ));
466
+ }
463
467
464
468
return ;
465
469
}
466
470
471
+ /* * * *\
472
+ GetHwndFromPGroup -
473
+ In goes a PGROUP out comes a HWND
474
+ RETURNS -
475
+ HWND.
476
+ \* * * */
477
+ HWND GetHwndFromPGroup (_In_ PGROUP pg )
478
+ {
479
+ EnumChildWindows (g_hWndProgMgr , & GetHwndFromPGroupEnum , (LPARAM )pg );
480
+
481
+ return hWndFoundGroup ;
482
+ }
483
+
484
+ /* * * *\
485
+ GetHwndFromPGroupEnum -
486
+ Enum Function
487
+ RETURNS -
488
+ HWND.
489
+ \* * * */
490
+ BOOL GetHwndFromPGroupEnum (_In_ HWND hwnd , _In_ LPARAM lParam )
491
+ {
492
+ if (lParam == GetWindowLongPtr (hwnd , GWLP_USERDATA ))
493
+ {
494
+ hWndFoundGroup = hwnd ;
495
+ return FALSE;
496
+ }
497
+ else
498
+ {
499
+ hWndFoundGroup = NULL ;
500
+ return TRUE;
501
+ }
502
+ }
503
+
467
504
/* * * *\
468
505
VerifyGroup -
469
506
Verifies that a group contains the
0 commit comments