-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathold.cpp
More file actions
4268 lines (3886 loc) · 175 KB
/
Copy pathold.cpp
File metadata and controls
4268 lines (3886 loc) · 175 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "stdafx.h" // - Draftsman-Dan
#pragma warning(disable: 4100 4244 4267 4189 4312)
#include <windows.h>
#include "TaskbarWindow.h"
#include "StartButton.h"
#include "ClockWidget.h"
#include "TaskbarProperties.h"
#include "Logger.h"
#include "resource.h"
#include "Config.h"
#include "DesktopWindow.h"
#include <dwmapi.h>
#include <windowsx.h>
#include <uxtheme.h>
#include <vssym32.h>
#include <vector>
#include <shellapi.h>
#include <shobjidl.h>
#include <propkey.h>
#include "TrayIconScraper.h"
#include <commctrl.h>
#include <shlobj.h>
#include <tlhelp32.h>
#define WM_TRAY_CALLBACK_WIN32EXPLORER (WM_USER + 500)
#define WM_TRAY_CALLBACK_TASKBAR (WM_USER + 501)
#define WM_TRAY_CALLBACK_DESKTOP (WM_USER + 502)
#define TRAY_LIMIT 48
static void InvokeNativeRunDialog(HWND hwndOwner);
#include <shlwapi.h>
#pragma comment(lib, "shlwapi.lib")
class FolderBand {
public:
HWND hToolbar;
HIMAGELIST hImgListSmall;
HIMAGELIST hImgListLarge;
std::wstring folderName;
std::wstring folderPath;
std::vector<std::wstring*> buttonTargets;
bool showTitle;
bool showText;
int iconSize; // 0 = small, 1 = large
FolderBand() : hToolbar(NULL), hImgListSmall(NULL), hImgListLarge(NULL), showTitle(true), showText(false), iconSize(0) {}
~FolderBand() {
if (hToolbar) {
DestroyWindow(hToolbar);
}
if (hImgListSmall) {
ImageList_Destroy(hImgListSmall);
}
if (hImgListLarge) {
ImageList_Destroy(hImgListLarge);
}
for (auto* ptr : buttonTargets) {
delete ptr;
}
}
void LoadCacheSettings() {
HKEY hKey;
std::wstring keyPath = L"SOFTWARE\\EliteSoftware\\EliteShell\\EliteTaskbar\\Toolbars\\Cache\\" + folderName;
if (RegOpenKeyExW(HKEY_CURRENT_USER, keyPath.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
DWORD val = 0, cb = sizeof(DWORD);
if (RegQueryValueExW(hKey, L"ShowTitle", NULL, NULL, (LPBYTE)&val, &cb) == ERROR_SUCCESS) {
showTitle = (val != 0);
}
cb = sizeof(DWORD);
if (RegQueryValueExW(hKey, L"ShowText", NULL, NULL, (LPBYTE)&val, &cb) == ERROR_SUCCESS) {
showText = (val != 0);
}
cb = sizeof(DWORD);
if (RegQueryValueExW(hKey, L"IconSize", NULL, NULL, (LPBYTE)&val, &cb) == ERROR_SUCCESS) {
iconSize = (int)val;
}
RegCloseKey(hKey);
}
}
void SaveCacheSettings() {
HKEY hKey;
std::wstring keyPath = L"SOFTWARE\\EliteSoftware\\EliteShell\\EliteTaskbar\\Toolbars\\Cache\\" + folderName;
if (RegCreateKeyExW(HKEY_CURRENT_USER, keyPath.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) {
DWORD val = showTitle ? 1 : 0;
RegSetValueExW(hKey, L"ShowTitle", 0, REG_DWORD, (const BYTE*)&val, sizeof(DWORD));
val = showText ? 1 : 0;
RegSetValueExW(hKey, L"ShowText", 0, REG_DWORD, (const BYTE*)&val, sizeof(DWORD));
val = iconSize;
RegSetValueExW(hKey, L"IconSize", 0, REG_DWORD, (const BYTE*)&val, sizeof(DWORD));
RegCloseKey(hKey);
}
}
bool Initialize(HWND hParentRebar, const std::wstring& name, const std::wstring& rawPath) {
folderName = name;
wchar_t expanded[MAX_PATH];
ExpandEnvironmentStringsW(rawPath.c_str(), expanded, MAX_PATH);
folderPath = expanded;
LoadCacheSettings();
hImgListSmall = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 10);
hImgListLarge = ImageList_Create(32, 32, ILC_COLOR32 | ILC_MASK, 0, 10);
DWORD style = WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | CCS_NORESIZE | CCS_NODIVIDER;
if (showText) {
style |= TBSTYLE_LIST;
}
hToolbar = CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL, style, 0, 0, 0, 0, hParentRebar, NULL, GetModuleHandle(NULL), NULL);
if (!hToolbar) return false;
SendMessageW(hToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
SendMessageW(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)(iconSize == 1 ? hImgListLarge : hImgListSmall));
int btnDim = iconSize == 1 ? 32 : 16;
SendMessageW(hToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(btnDim, btnDim));
std::wstring searchPath = folderPath + L"\\*";
WIN32_FIND_DATAW fd;
HANDLE hFind = FindFirstFileW(searchPath.c_str(), &fd);
if (hFind != INVALID_HANDLE_VALUE) {
int imageIndex = 0;
std::vector<TBBUTTON> buttons;
do {
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
continue;
}
std::wstring fileName = fd.cFileName;
std::wstring fullPath = folderPath + L"\\" + fileName;
HICON hIconSmall = NULL;
HICON hIconLarge = NULL;
SHFILEINFOW sfi;
if (SHGetFileInfoW(fullPath.c_str(), 0, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SMALLICON)) {
hIconSmall = sfi.hIcon;
}
if (SHGetFileInfoW(fullPath.c_str(), 0, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_LARGEICON)) {
hIconLarge = sfi.hIcon;
}
if (hIconSmall && hIconLarge) {
ImageList_AddIcon(hImgListSmall, hIconSmall);
ImageList_AddIcon(hImgListLarge, hIconLarge);
DestroyIcon(hIconSmall);
DestroyIcon(hIconLarge);
TBBUTTON btn = {0};
btn.iBitmap = imageIndex++;
btn.idCommand = 20000 + imageIndex;
btn.fsState = TBSTATE_ENABLED;
btn.fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
std::wstring* pPath = new std::wstring(fullPath);
buttonTargets.push_back(pPath);
btn.dwData = (DWORD_PTR)pPath;
wchar_t label[MAX_PATH];
wcscpy_s(label, fileName.c_str());
PathRemoveExtensionW(label);
btn.iString = (INT_PTR)label;
buttons.push_back(btn);
}
} while (FindNextFileW(hFind, &fd));
FindClose(hFind);
if (!buttons.empty()) {
SendMessageW(hToolbar, TB_ADDBUTTONS, buttons.size(), (LPARAM)buttons.data());
}
}
SendMessageW(hToolbar, TB_SETPADDING, 0, MAKELPARAM(6, 4));
SendMessageW(hToolbar, TB_AUTOSIZE, 0, 0);
return true;
}
void ToggleTitle(HWND hRebar, int bandIndex) {
showTitle = !showTitle;
REBARBANDINFOW rbbi = {0};
rbbi.cbSize = sizeof(rbbi);
rbbi.fMask = RBBIM_STYLE;
SendMessageW(hRebar, RB_GETBANDINFO, bandIndex, (LPARAM)&rbbi);
if (showTitle) {
rbbi.fStyle &= ~RBBS_HIDETITLE;
} else {
rbbi.fStyle |= RBBS_HIDETITLE;
}
SendMessageW(hRebar, RB_SETBANDINFO, bandIndex, (LPARAM)&rbbi);
SaveCacheSettings();
}
void ToggleText() {
showText = !showText;
DWORD style = GetWindowLongW(hToolbar, GWL_STYLE);
if (showText) {
style |= TBSTYLE_LIST;
} else {
style &= ~TBSTYLE_LIST;
}
SetWindowLongW(hToolbar, GWL_STYLE, style);
SendMessageW(hToolbar, TB_AUTOSIZE, 0, 0);
SaveCacheSettings();
}
void ToggleIconSize() {
iconSize = (iconSize == 0) ? 1 : 0;
SendMessageW(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)(iconSize == 1 ? hImgListLarge : hImgListSmall));
int btnDim = iconSize == 1 ? 32 : 16;
SendMessageW(hToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(btnDim, btnDim));
SendMessageW(hToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(btnDim + 12, btnDim + 12));
SendMessageW(hToolbar, TB_AUTOSIZE, 0, 0);
SaveCacheSettings();
}
};
std::vector<FolderBand*> g_FolderBands;
bool g_IsRestarting = false;
std::wstring ResolveShortcut(const std::wstring& shortcutPath) {
CoInitialize(NULL);
IShellLinkW* psl = NULL;
std::wstring targetPath = shortcutPath;
HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void**)&psl);
if (SUCCEEDED(hr)) {
IPersistFile* ppf = NULL;
hr = psl->QueryInterface(IID_IPersistFile, (void**)&ppf);
if (SUCCEEDED(hr)) {
hr = ppf->Load(shortcutPath.c_str(), STGM_READ);
if (SUCCEEDED(hr)) {
wchar_t szGotPath[MAX_PATH];
WIN32_FIND_DATAW wfd;
hr = psl->GetPath(szGotPath, MAX_PATH, &wfd, SLGP_UNCPRIORITY);
if (SUCCEEDED(hr) && wcslen(szGotPath) > 0) {
targetPath = szGotPath;
}
}
ppf->Release();
}
psl->Release();
}
return targetPath;
}
void ExecuteTarget(const std::wstring& path) {
std::wstring finalPath = path;
if (path.length() > 4 && _wcsicmp(path.c_str() + path.length() - 4, L".lnk") == 0) {
finalPath = ResolveShortcut(path);
}
SHELLEXECUTEINFOW sei = {0};
sei.cbSize = sizeof(sei);
sei.fMask = SEE_MASK_DEFAULT;
sei.lpFile = finalPath.c_str();
sei.nShow = SW_SHOWNORMAL;
ShellExecuteExW(&sei);
}
void LoadFolderToolbars(HWND hRebar) {
HKEY hKey;
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"SOFTWARE\\EliteSoftware\\EliteShell\\EliteTaskbar\\Toolbars", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
wchar_t valueName[16384];
DWORD cbValueName = 16384;
wchar_t valueData[16384];
DWORD cbValueData = 16384;
DWORD dwType = 0;
DWORD dwIndex = 0;
while (RegEnumValueW(hKey, dwIndex, valueName, &cbValueName, NULL, &dwType, (LPBYTE)valueData, &cbValueData) == ERROR_SUCCESS) {
if (dwType == REG_SZ) {
FolderBand* band = new FolderBand();
if (band->Initialize(hRebar, valueName, valueData)) {
REBARBANDINFOW rbbi = {0};
rbbi.cbSize = sizeof(rbbi);
rbbi.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_TEXT;
rbbi.fStyle = RBBS_GRIPPERALWAYS | RBBS_CHILDEDGE;
if (!band->showTitle) {
rbbi.fStyle |= RBBS_HIDETITLE;
}
rbbi.hwndChild = band->hToolbar;
rbbi.lpText = (LPWSTR)band->folderName.c_str();
RECT rc;
GetWindowRect(band->hToolbar, &rc);
rbbi.fMask |= RBBIM_IDEALSIZE;
rbbi.fStyle |= RBBS_USECHEVRON;
rbbi.cxMinChild = 0; // Allow shrinking so the chevron appears
rbbi.cyMinChild = rc.bottom - rc.top;
rbbi.cxIdeal = rc.right - rc.left;
rbbi.cx = rbbi.cxIdeal + 40;
SendMessageW(hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbbi);
g_FolderBands.push_back(band);
} else {
delete band;
}
}
cbValueName = 16384;
cbValueData = 16384;
dwIndex++;
}
RegCloseKey(hKey);
}
}
extern EliteTaskbarConfig g_Config;
static bool s_UseSecondaryTrayWndAsFallback = false;
#include <string>
#include <map>
extern std::wstring GetScrapedTrayTooltip(HWND hwnd, UINT uID);
extern std::vector<ScrapedTrayIcon> g_CurrentTrayIcons;
const IID MyIID_IShellItemImageFactory = { 0xbcc18b79, 0xba61, 0x4927, { 0xb5, 0x92, 0x6c, 0x4c, 0x7d, 0x07, 0xef, 0x3c } };
const IID MyIID_IPropertyStore = { 0x886d8eeb, 0x8cf2, 0x4446, { 0x8d, 0x02, 0xcd, 0xba, 0x1d, 0xbd, 0xcf, 0x99 } };
const IID MyIID_IShellItem = { 0x43826d1e, 0xe718, 0x42ee, { 0xbc, 0x55, 0xa1, 0xe2, 0x61, 0xc3, 0x7b, 0xfe } };
const PROPERTYKEY MyPKEY_AppUserModel_ID = { { 0x9f4c6855, 0x9979, 0x4ee3, { 0xa0, 0x8a, 0x31, 0xe3, 0xac, 0x3f, 0x00, 0xd7 } }, 5 };
struct EliteTrayIcon {
HWND hWnd;
UINT uID;
UINT uCallbackMessage;
HICON hIcon;
WCHAR szTip[128];
DWORD dwState;
GUID guidItem; // - Draftsman-Dan
bool bUseGUID; // - Draftsman-Dan
};
std::vector<EliteTrayIcon> g_TrayIcons;
// Helper to get DPI for a window - Builder-Bob
int GetDpiForWindowHelper(HWND hwnd) {
UINT dpi = 96;
HMODULE hShcore = LoadLibraryW(L"shcore.dll");
if (hShcore) {
typedef HRESULT(STDAPICALLTYPE* GetDpiForMonitorFn)(HMONITOR, int, UINT*, UINT*);
GetDpiForMonitorFn fn = (GetDpiForMonitorFn)GetProcAddress(hShcore, "GetDpiForMonitor");
if (fn) {
HMONITOR hMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
UINT dpiX = 96, dpiY = 96;
fn(hMon, 0, &dpiX, &dpiY);
dpi = dpiX;
}
FreeLibrary(hShcore);
} else {
HDC hdc = GetDC(NULL);
if (hdc) {
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(NULL, hdc);
}
}
return dpi;
}
// Calculate the number of icons that fit in the tray - Builder-Bob
int GetTrayVisibleLimit(HWND hwndTrayNotify, int dpi, int totalVisible) {
bool bIsWin7Mode = (g_Config.OverflowMode == TrayOverflowMode::Win7Flyout);
if (g_Config.ManualTrayWidth > 0) {
int W_tray = MulDiv(g_Config.ManualTrayWidth, dpi, 96);
if (g_Config.EnableTwoRowTray) {
int colWidth = MulDiv(18, dpi, 96);
int cols = W_tray / colWidth;
if (cols < 1) cols = 1;
return cols * 2;
} else {
int btnWidth = MulDiv(24, dpi, 96);
int cols = W_tray / btnWidth;
if (cols < 1) cols = 1;
return cols;
}
} else {
if (bIsWin7Mode) {
return TRAY_LIMIT;
} else {
return g_Config.EnableTwoRowTray ? 8 : 5;
}
}
}
void UpdateTrayToolbarFromIndependent(TaskbarInstance* inst) {
// Filter out non-existent windows/threads - Builder-Bob
for (auto it = g_TrayIcons.begin(); it != g_TrayIcons.end(); ) {
if (it->hWnd && !IsWindow(it->hWnd)) {
if (it->hIcon) DestroyIcon(it->hIcon);
it = g_TrayIcons.erase(it);
} else {
++it;
}
}
std::vector<ScrapedTrayIcon> icons;
for (const auto& icon : g_TrayIcons) {
if (icon.hIcon && !(icon.dwState & NIS_HIDDEN)) {
ScrapedTrayIcon si;
si.hwnd = icon.hWnd;
si.uCallbackMessage = icon.uCallbackMessage;
si.uID = icon.uID;
si.hIcon = icon.hIcon;
si.bOwnsIcon = false; // Managed by g_TrayIcons - Builder-Bob
icons.push_back(si);
}
}
UpdateTrayToolbar(inst->hToolbar, inst->hTrayImageList, icons);
}
void UpdateTaskbarLayout(TaskbarInstance* inst);
inline int GetTooltipLastIndex(HWND hwnd) {
return (int)(intptr_t)GetPropW(hwnd, L"TooltipLastIndex") - 1;
}
inline void SetTooltipLastIndex(HWND hwnd, int idx) {
SetPropW(hwnd, L"TooltipLastIndex", (HANDLE)(intptr_t)(idx + 1));
}
inline bool GetTooltipTracking(HWND hwnd) {
return (GetPropW(hwnd, L"TooltipTracking") != NULL);
}
inline void SetTooltipTracking(HWND hwnd, bool tracking) {
if (tracking) SetPropW(hwnd, L"TooltipTracking", (HANDLE)1);
else RemovePropW(hwnd, L"TooltipTracking");
}
HWND GetOrCreateTrayTooltip(HWND hParent) {
static HWND hTip = NULL;
if (!hTip || !IsWindow(hTip)) {
hTip = CreateWindowExW(WS_EX_TOPMOST, TOOLTIPS_CLASSW, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, GetModuleHandle(NULL), NULL);
}
return hTip;
}
void UpdateTooltipText(HWND hTip, HWND hParent, const std::wstring& text, POINT ptScreen) {
TOOLINFOW ti = {0};
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_TRACK | TTF_ABSOLUTE;
ti.hwnd = hParent;
ti.uId = (UINT_PTR)hParent;
ti.lpszText = (LPWSTR)text.c_str();
SendMessageW(hTip, TTM_ADDTOOLW, 0, (LPARAM)&ti);
SendMessageW(hTip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
SendMessageW(hTip, TTM_TRACKPOSITION, 0, MAKELPARAM(ptScreen.x, ptScreen.y - 24));
SendMessageW(hTip, TTM_TRACKACTIVATE, TRUE, (LPARAM)&ti);
}
void HideTooltip(HWND hTip, HWND hParent) {
if (hTip) {
TOOLINFOW ti = {0};
ti.cbSize = sizeof(ti);
ti.hwnd = hParent;
ti.uId = (UINT_PTR)hParent;
SendMessageW(hTip, TTM_TRACKACTIVATE, FALSE, (LPARAM)&ti);
SendMessageW(hTip, TTM_DELTOOLW, 0, (LPARAM)&ti);
}
}
LRESULT CALLBACK TrayToolbarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) {
// Forward mouse events in left 0-5px margin to parent hTrayNotify - Draftsman-Dan
if (uMsg == WM_SETCURSOR) {
POINT pt;
GetCursorPos(&pt);
ScreenToClient(hWnd, &pt);
if (pt.x >= 0 && pt.x <= 5) {
HWND hParent = GetParent(hWnd);
return SendMessageW(hParent, uMsg, wParam, lParam);
}
}
if (uMsg == WM_MOUSEMOVE || uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONUP ||
uMsg == WM_LBUTTONDBLCLK || uMsg == WM_RBUTTONDOWN || uMsg == WM_RBUTTONUP ||
uMsg == WM_RBUTTONDBLCLK || uMsg == WM_MBUTTONDOWN || uMsg == WM_MBUTTONUP ||
uMsg == WM_MBUTTONDBLCLK)
{
int x = GET_X_LPARAM(lParam);
int y = GET_Y_LPARAM(lParam);
if (x >= 0 && x <= 5) {
POINT pt = { x, y };
ClientToScreen(hWnd, &pt);
HWND hParent = GetParent(hWnd);
ScreenToClient(hParent, &pt);
return SendMessageW(hParent, uMsg, wParam, MAKELPARAM(pt.x, pt.y));
}
}
switch (uMsg) {
case WM_ERASEBKGND: {
HDC hdc = (HDC)wParam;
RECT rc;
GetClientRect(hWnd, &rc);
DrawThemeParentBackground(hWnd, hdc, &rc);
return TRUE;
}
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
if (hdc) {
RECT rc;
GetClientRect(hWnd, &rc);
DrawThemeParentBackground(hWnd, hdc, &rc);
SendMessageW(hWnd, WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT);
}
EndPaint(hWnd, &ps);
return 0;
}
case WM_PRINTCLIENT: {
HDC hdc = (HDC)wParam;
RECT rc;
GetClientRect(hWnd, &rc);
DrawThemeParentBackground(hWnd, hdc, &rc);
break; // Let default procedure draw buttons/icons - Builder-Bob
}
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_RBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MBUTTONDBLCLK: {
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
int index = (int)SendMessageW(hWnd, TB_HITTEST, 0, (LPARAM)&pt);
if (index >= 0 && index < (int)g_CurrentTrayIcons.size()) {
const auto& icon = g_CurrentTrayIcons[index];
TaskbarInstance* inst = (TaskbarInstance*)dwRefData;
extern void StartNativeTaskbarSpoof(HWND hClickedTaskbar);
if (inst) {
StartNativeTaskbarSpoof(inst->hTaskbar);
}
bool isClick = (uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONUP || uMsg == WM_RBUTTONDOWN || uMsg == WM_RBUTTONUP || uMsg == WM_LBUTTONDBLCLK || uMsg == WM_RBUTTONDBLCLK);
HWND hShellTrayWnd = NULL;
RECT rcOriginal = { 0 };
bool shifted = false;
if (isClick) {
hShellTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL);
if (hShellTrayWnd) {
HMONITOR hMon = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONULL);
if (hMon) {
SendMessageW(hShellTrayWnd, WM_SETREDRAW, FALSE, 0);
GetWindowRect(hShellTrayWnd, &rcOriginal);
POINT ptScreen = pt;
ClientToScreen(hWnd, &ptScreen);
SetWindowPos(hShellTrayWnd, NULL, ptScreen.x - 16, rcOriginal.top, rcOriginal.right - rcOriginal.left, rcOriginal.bottom - rcOriginal.top, SWP_NOZORDER | SWP_NOACTIVATE);
shifted = true;
}
}
}
PostMessageW(icon.hwnd, icon.uCallbackMessage, icon.uID, uMsg);
if (shifted) {
Sleep(50);
SetWindowPos(hShellTrayWnd, NULL, rcOriginal.left, rcOriginal.top, rcOriginal.right - rcOriginal.left, rcOriginal.bottom - rcOriginal.top, SWP_NOZORDER | SWP_NOACTIVATE);
SendMessageW(hShellTrayWnd, WM_SETREDRAW, TRUE, 0);
RedrawWindow(hShellTrayWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
}
}
break;
}
case WM_MOUSEMOVE: {
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
int index = (int)SendMessageW(hWnd, TB_HITTEST, 0, (LPARAM)&pt);
bool bTracking = GetTooltipTracking(hWnd);
if (!bTracking) {
TRACKMOUSEEVENT tme = {0};
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hWnd;
TrackMouseEvent(&tme);
SetTooltipTracking(hWnd, true);
}
int lastIndex = GetTooltipLastIndex(hWnd);
if (index != lastIndex) {
SetTooltipLastIndex(hWnd, index);
HWND hTip = GetOrCreateTrayTooltip(hWnd);
if (index >= 0 && index < (int)g_CurrentTrayIcons.size()) {
const auto& icon = g_CurrentTrayIcons[index];
std::wstring tip = GetScrapedTrayTooltip(icon.hwnd, icon.uID);
if (!tip.empty()) {
POINT ptScreen = pt;
ClientToScreen(hWnd, &ptScreen);
UpdateTooltipText(hTip, hWnd, tip, ptScreen);
} else {
HideTooltip(hTip, hWnd);
}
} else {
HideTooltip(hTip, hWnd);
}
} else if (index >= 0) {
HWND hTip = GetOrCreateTrayTooltip(hWnd);
POINT ptScreen = pt;
ClientToScreen(hWnd, &ptScreen);
SendMessageW(hTip, TTM_TRACKPOSITION, 0, MAKELPARAM(ptScreen.x, ptScreen.y - 24));
}
if (index >= 0 && index < (int)g_CurrentTrayIcons.size()) {
const auto& icon = g_CurrentTrayIcons[index];
PostMessageW(icon.hwnd, icon.uCallbackMessage, icon.uID, uMsg);
}
break;
}
case WM_MOUSELEAVE: {
SetTooltipTracking(hWnd, false);
SetTooltipLastIndex(hWnd, -1);
HWND hTip = GetOrCreateTrayTooltip(hWnd);
HideTooltip(hTip, hWnd);
break;
}
case WM_DESTROY: {
RemoveWindowSubclass(hWnd, TrayToolbarSubclassProc, uIdSubclass);
break;
}
}
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
std::wstring GetIndependentTrayTooltip(HWND hwndIcon, UINT uID) {
for (const auto& icon : g_TrayIcons) {
if (icon.hWnd == hwndIcon && icon.uID == uID) {
return icon.szTip;
}
}
return L"";
}
LRESULT CALLBACK SysPagerSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) {
if (uMsg == WM_NOTIFY) {
LPNMHDR lpnmhdr = (LPNMHDR)lParam;
if (lpnmhdr->code == TTN_GETDISPINFOW) {
LPNMTTDISPINFOW lpnmt = (LPNMTTDISPINFOW)lParam;
int idx = (int)lpnmt->hdr.idFrom;
if (idx >= 0 && idx < (int)g_CurrentTrayIcons.size()) {
const auto& icon = g_CurrentTrayIcons[idx];
std::wstring tipText;
if (g_Config.Mode == TaskbarMode::Independent) {
tipText = GetIndependentTrayTooltip(icon.hwnd, icon.uID);
} else {
tipText = GetScrapedTrayTooltip(icon.hwnd, icon.uID);
}
if (!tipText.empty()) {
wcsncpy_s(lpnmt->szText, tipText.c_str(), _TRUNCATE);
} else {
lpnmt->szText[0] = L'\0';
}
return 0;
}
}
}
if (uMsg == WM_ERASEBKGND) {
HDC hdc = (HDC)wParam;
RECT rc;
GetClientRect(hWnd, &rc);
DrawThemeParentBackground(hWnd, hdc, &rc);
return TRUE;
}
if (uMsg == WM_PAINT) {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
if (hdc) {
RECT rc;
GetClientRect(hWnd, &rc);
DrawThemeParentBackground(hWnd, hdc, &rc);
}
EndPaint(hWnd, &ps);
return 0;
}
if (uMsg == WM_PRINTCLIENT) {
HDC hdc = (HDC)wParam;
RECT rc;
GetClientRect(hWnd, &rc);
DrawThemeParentBackground(hWnd, hdc, &rc);
return 0;
}
if (uMsg == WM_DESTROY) {
RemoveWindowSubclass(hWnd, SysPagerSubclassProc, uIdSubclass);
}
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
HICON GetWindowIconFix(HWND hwnd) {
if (!hwnd || !IsWindow(hwnd)) return NULL;
WCHAR szClass[256] = {0};
GetClassNameW(hwnd, szClass, 256);
if (wcscmp(szClass, L"ApplicationFrameWindow") == 0) {
HMODULE hShell32 = GetModuleHandleW(L"shell32.dll");
if (hShell32) {
typedef HRESULT(STDAPICALLTYPE* SHGetPropertyStoreForWindowFn)(HWND, REFIID, void**);
SHGetPropertyStoreForWindowFn fnGetProp = (SHGetPropertyStoreForWindowFn)GetProcAddress(hShell32, "SHGetPropertyStoreForWindow");
if (fnGetProp) {
IPropertyStore* pPropStore = NULL;
HRESULT hr = fnGetProp(hwnd, MyIID_IPropertyStore, (void**)&pPropStore);
if (SUCCEEDED(hr) && pPropStore) {
PROPVARIANT pv;
PropVariantInit(&pv);
hr = pPropStore->GetValue(MyPKEY_AppUserModel_ID, &pv);
if (SUCCEEDED(hr) && pv.vt == VT_LPWSTR && pv.pwszVal) {
typedef HRESULT(STDAPICALLTYPE* SHCreateItemFromParsingNameFn)(PCWSTR, IBindCtx*, REFIID, void**);
SHCreateItemFromParsingNameFn fnCreateItem = (SHCreateItemFromParsingNameFn)GetProcAddress(hShell32, "SHCreateItemFromParsingName");
if (fnCreateItem) {
std::wstring shellPath = L"shell:AppsFolder\\" + std::wstring(pv.pwszVal);
IShellItem* pShellItem = NULL;
hr = fnCreateItem(shellPath.c_str(), NULL, MyIID_IShellItem, (void**)&pShellItem);
if (SUCCEEDED(hr) && pShellItem) {
IShellItemImageFactory* pImgFactory = NULL;
hr = pShellItem->QueryInterface(MyIID_IShellItemImageFactory, (void**)&pImgFactory);
if (SUCCEEDED(hr) && pImgFactory) {
SIZE szIcon = { 16, 16 };
HBITMAP hBitmap = NULL;
hr = pImgFactory->GetImage(szIcon, SIIGBF_ICONONLY, &hBitmap);
if (SUCCEEDED(hr) && hBitmap) {
HBITMAP hbmMask = CreateBitmap(16, 16, 1, 1, NULL);
ICONINFO ii = {0};
ii.fIcon = TRUE;
ii.hbmMask = hbmMask;
ii.hbmColor = hBitmap;
HICON hIcon = CreateIconIndirect(&ii);
DeleteObject(hbmMask);
DeleteObject(hBitmap);
pImgFactory->Release();
pShellItem->Release();
PropVariantClear(&pv);
pPropStore->Release();
if (hIcon) return hIcon;
}
pImgFactory->Release();
}
pShellItem->Release();
}
}
}
PropVariantClear(&pv);
pPropStore->Release();
}
}
}
struct EnumData {
HWND hwndTarget;
DWORD pid;
};
EnumData data = { NULL, 0 };
EnumChildWindows(hwnd, [](HWND hChild, LPARAM lParam) -> BOOL {
WCHAR szChildClass[256] = {0};
GetClassNameW(hChild, szChildClass, 256);
if (wcscmp(szChildClass, L"Windows.UI.Core.CoreWindow") == 0) {
EnumData* pData = (EnumData*)lParam;
pData->hwndTarget = hChild;
GetWindowThreadProcessId(hChild, &pData->pid);
return FALSE;
}
return TRUE;
}, (LPARAM)&data);
if (data.pid) {
HANDLE hProc = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, data.pid);
if (hProc) {
WCHAR exePath[MAX_PATH] = {0};
DWORD dwSize = MAX_PATH;
if (QueryFullProcessImageNameW(hProc, 0, exePath, &dwSize)) {
SHFILEINFOW sfi = {0};
if (SHGetFileInfoW(exePath, 0, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SMALLICON)) {
CloseHandle(hProc);
if (sfi.hIcon) return sfi.hIcon;
}
}
CloseHandle(hProc);
}
}
}
DWORD_PTR dwRes = 0;
if (SendMessageTimeoutW(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 500, &dwRes) && dwRes) {
return (HICON)dwRes;
}
HICON hClassIcon = (HICON)GetClassLongPtrW(hwnd, GCLP_HICONSM);
if (hClassIcon) return hClassIcon;
return NULL;
}
void UpdateTaskbarLayout(TaskbarInstance* inst) {
if (!inst || !inst->hTaskbar) return;
RECT rcClient;
GetClientRect(inst->hTaskbar, &rcClient);
int taskbarWidth = rcClient.right - rcClient.left;
int taskbarHeight = rcClient.bottom - rcClient.top;
UINT dpi = 96;
HMODULE hShcore = LoadLibraryW(L"shcore.dll");
if (hShcore) {
typedef HRESULT(STDAPICALLTYPE* GetDpiForMonitorFn)(HMONITOR, int, UINT*, UINT*);
GetDpiForMonitorFn fn = (GetDpiForMonitorFn)GetProcAddress(hShcore, "GetDpiForMonitor");
if (fn) {
UINT dpiX = 96, dpiY = 96;
fn(inst->hMonitor, 0, &dpiX, &dpiY);
dpi = dpiX;
}
FreeLibrary(hShcore);
} else {
HDC hdc = GetDC(NULL);
if (hdc) {
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(NULL, hdc);
}
}
int W_clock = MulDiv(85, dpi, 96);
if (g_Config.DynamicClockWidth) { // - Draftsman-Dan
SYSTEMTIME st;
GetLocalTime(&st);
wchar_t timeBuf[32];
wchar_t dateBuf[32];
GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, timeBuf, 32);
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, dateBuf, 32);
wchar_t clockText[128];
swprintf_s(clockText, L"%s\n%s", timeBuf, dateBuf);
HDC hdc = GetDC(inst->hTaskbar);
if (hdc) {
LOGFONTW lf = {0};
lf.lfHeight = MulDiv(-11, dpi, 96);
lf.lfWeight = FW_NORMAL;
wcscpy_s(lf.lfFaceName, L"Segoe UI");
HFONT hFont = CreateFontIndirectW(&lf);
HFONT hOldFont = NULL;
if (hFont) hOldFont = (HFONT)SelectObject(hdc, hFont);
RECT rcCalc = {0};
DrawTextW(hdc, clockText, -1, &rcCalc, DT_CALCRECT);
int textWidth = rcCalc.right - rcCalc.left;
W_clock = textWidth + MulDiv(12, dpi, 96); // tight padding 6px per side
if (hOldFont) SelectObject(hdc, hOldFont);
if (hFont) DeleteObject(hFont);
ReleaseDC(inst->hTaskbar, hdc);
}
}
int W_showDesktop = MulDiv(15, dpi, 96);
HWND hShowDesktop = FindWindowExW(inst->hTaskbar, NULL, L"TrayShowDesktopButtonWClass", NULL);
if (hShowDesktop) {
SetWindowPos(hShowDesktop, NULL, taskbarWidth - W_showDesktop, 0, W_showDesktop, taskbarHeight, SWP_NOZORDER | SWP_NOACTIVATE);
}
int W_tray = 100;
int W_notify = 240;
if (inst->hTrayNotify) {
bool enableClock = (inst->hTrayClock != NULL);
bool enableTray = (inst->hToolbar != NULL);
int totalVisible = (int)g_CurrentTrayIcons.size();
if (g_Config.Mode == TaskbarMode::Independent) {
totalVisible = 0;
for (const auto& icon : g_TrayIcons) {
if (icon.hIcon && !(icon.dwState & NIS_HIDDEN)) totalVisible++;
}
}
int limit = GetTrayVisibleLimit(inst->hTrayNotify, dpi, totalVisible);
bool hasOverflow = (totalVisible > limit);
bool bIsExpanded = (GetPropW(inst->hTrayNotify, L"TrayExpanded") != NULL);
if (g_Config.ManualTrayWidth > 0 && !bIsExpanded) {
W_tray = MulDiv(g_Config.ManualTrayWidth, dpi, 96);
} else if (inst->hToolbar && enableTray) { // Compute tray layout width dynamically
int btnCount = (int)SendMessageW(inst->hToolbar, TB_BUTTONCOUNT, 0, 0);
if (btnCount > 0) {
// First, enforce the visibility limit on the buttons
for (int idx = 0; idx < btnCount; ++idx) {
LRESULT state = SendMessageW(inst->hToolbar, TB_GETSTATE, idx, 0);
if (!bIsExpanded && totalVisible > limit && idx < (totalVisible - limit)) {
state |= TBSTATE_HIDDEN;
} else {
state &= ~TBSTATE_HIDDEN;
}
SendMessageW(inst->hToolbar, TB_SETSTATE, idx, state);
}
if (g_Config.EnableTwoRowTray) {
int visCount = 0;
for (int idx = 0; idx < btnCount; ++idx) {
if (!(SendMessageW(inst->hToolbar, TB_GETSTATE, idx, 0) & TBSTATE_HIDDEN)) visCount++;
}
int colCount = (visCount + 1) / 2;
W_tray = colCount * MulDiv(15, dpi, 96) + 4; // 15px per column in two-row mode
} else {
SendMessageW(inst->hToolbar, TB_AUTOSIZE, 0, 0);
int maxWidth = 0;
for (int idx = 0; idx < btnCount; ++idx) {
if (SendMessageW(inst->hToolbar, TB_GETSTATE, idx, 0) & TBSTATE_HIDDEN) continue;
RECT rcItem = { 0 };
if (SendMessageW(inst->hToolbar, TB_GETITEMRECT, idx, (LPARAM)&rcItem)) {
if (rcItem.right > maxWidth) {
maxWidth = rcItem.right;
}
}
}
if (maxWidth > 0) {
W_tray = maxWidth + 4;
} else {
W_tray = 0;
}
}
} else {
W_tray = 0;
}
} else {
W_tray = 0;
}
int W_overflowBtn = MulDiv(18, dpi, 96);
W_notify = W_tray + (hasOverflow ? W_overflowBtn : 0) + (enableClock ? W_clock : 0);
int xNotify = taskbarWidth - W_showDesktop - W_notify;
SetWindowPos(inst->hTrayNotify, NULL, xNotify, 0, W_notify, taskbarHeight, SWP_NOZORDER | SWP_NOACTIVATE);
if (enableTray && inst->hToolbar) {
int toolbarX = hasOverflow ? W_overflowBtn : 0;
if (g_Config.EnableTwoRowTray) {
int tbHeight = MulDiv(26, dpi, 96);
int tbY = (taskbarHeight - tbHeight) / 2;
SetWindowPos(inst->hToolbar, NULL, toolbarX, tbY, W_tray, tbHeight, SWP_NOZORDER | SWP_NOACTIVATE);
} else {
SetWindowPos(inst->hToolbar, NULL, toolbarX, 0, W_tray, taskbarHeight, SWP_NOZORDER | SWP_NOACTIVATE);
}
}
if (enableClock && inst->hTrayClock) {
int clockX = (hasOverflow ? W_overflowBtn : 0) + W_tray;
SetWindowPos(inst->hTrayClock, NULL, clockX, 0, W_clock, taskbarHeight, SWP_NOZORDER | SWP_NOACTIVATE);
}
InvalidateRect(inst->hTrayNotify, NULL, TRUE);
} else {
W_notify = 0;
}
if (inst->hTaskSwitch) {
HWND hOrb = inst->startButton ? inst->startButton->GetHwnd() : NULL;
int startButtonWidth = MulDiv(60, dpi, 96);
if (hOrb && IsWindow(hOrb)) {
RECT rcOrb;
GetWindowRect(hOrb, &rcOrb);
startButtonWidth = rcOrb.right - rcOrb.left;
}
int xTaskSwitch = startButtonWidth + MulDiv(6, dpi, 96);
int xNotifyStart = taskbarWidth - W_showDesktop - W_notify - MulDiv(10, dpi, 96);
int widthTaskSwitch = xNotifyStart - xTaskSwitch;
if (widthTaskSwitch < 0) widthTaskSwitch = 0;
// Position Rebar control - Builder-Bob
if (inst->hRebar && SendMessageW(inst->hRebar, RB_GETBANDCOUNT, 0, 0) > 0) {
SetWindowPos(inst->hRebar, NULL, xTaskSwitch, 0, widthTaskSwitch, taskbarHeight, SWP_NOZORDER | SWP_NOACTIVATE);
ShowWindow(inst->hRebar, SW_SHOW);
int bandCount = (int)SendMessageW(inst->hRebar, RB_GETBANDCOUNT, 0, 0);
if (bandCount > 0) {
int tbIndex = (int)SendMessageW(inst->hRebar, RB_IDTOINDEX, 2000, 0);
if (tbIndex >= 0) {
SendMessageW(inst->hRebar, RB_MAXIMIZEBAND, tbIndex, 0);
} else {
SendMessageW(inst->hRebar, RB_MAXIMIZEBAND, bandCount - 1, 0);
}
}
if (inst->hTaskSwitch) {
SendMessageW(inst->hTaskSwitch, TB_AUTOSIZE, 0, 0);
}
} else if (inst->hTaskSwitch) {
int switchHeight = taskbarHeight;
int switchY = 0;
DWORD dwBtnSize = (DWORD)SendMessageW(inst->hTaskSwitch, TB_GETBUTTONSIZE, 0, 0);
int btnHeight = HIWORD(dwBtnSize);
if (btnHeight > 0 && btnHeight < taskbarHeight) {
switchHeight = btnHeight;
switchY = (taskbarHeight - btnHeight) / 2;
}
SetWindowPos(inst->hTaskSwitch, NULL, xTaskSwitch, switchY, widthTaskSwitch, switchHeight, SWP_NOZORDER | SWP_NOACTIVATE);
SendMessageW(inst->hTaskSwitch, TB_AUTOSIZE, 0, 0);
}
} else {
// If taskband is disabled, the Rebar can span the whole client space - Builder-Bob
HWND hOrb = inst->startButton ? inst->startButton->GetHwnd() : NULL;