@@ -6,6 +6,7 @@ extern HWND PeopleButton_LastHWND;
6
6
extern DWORD dwWeatherToLeft ;
7
7
extern DWORD dwOldTaskbarAl ;
8
8
extern DWORD dwMMOldTaskbarAl ;
9
+ extern DWORD dwSearchboxTaskbarMode ;
9
10
extern wchar_t * EP_TASKBAR_LENGTH_PROP_NAME ;
10
11
#define EP_TASKBAR_LENGTH_TOO_SMALL 20
11
12
BOOL bTaskbarCenterHasPatchedSHWindowsPolicy = FALSE;
@@ -144,9 +145,11 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
144
145
{
145
146
GetClientRect (hWndStart , & rcStart );
146
147
HWND hTrayButton = NULL ;
147
- while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , L"TrayButton" , NULL ))
148
+ wchar_t * pCn = L"TrayButton" ;
149
+ if (!IsWindows11 () && dwSearchboxTaskbarMode == 2 ) pCn = L"TrayDummySearchControl" ;
150
+ while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , pCn , NULL ))
148
151
{
149
- if (!IsWindowVisible (hTrayButton )) continue ;
152
+ if (pCn == L"TrayButton" && !IsWindowVisible (hTrayButton )) continue ;
150
153
RECT rcTrayButton ;
151
154
GetClientRect (hTrayButton , & rcTrayButton );
152
155
if (bIsTaskbarHorizontal )
@@ -157,6 +160,10 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
157
160
{
158
161
rcStart .bottom += (rcTrayButton .bottom - rcTrayButton .top );
159
162
}
163
+ if (pCn == L"TrayDummySearchControl" ) {
164
+ pCn = L"TrayButton" ;
165
+ hTrayButton = NULL ;
166
+ }
160
167
}
161
168
}
162
169
RECT rc ;
@@ -180,13 +187,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
180
187
GetClientRect (hWndStart , & rcTrayButton );
181
188
DWORD dwDim = (rcTrayButton .right - rcTrayButton .left );
182
189
HWND hTrayButton = NULL ;
183
- while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , L"TrayButton" , NULL ))
190
+ wchar_t * pCn = L"TrayButton" ;
191
+ if (!IsWindows11 () && dwSearchboxTaskbarMode == 2 ) pCn = L"TrayDummySearchControl" ;
192
+ while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , pCn , NULL ))
184
193
{
185
- if (!IsWindowVisible (hTrayButton )) continue ;
194
+ if (pCn == L"TrayButton" && !IsWindowVisible (hTrayButton )) continue ;
186
195
GetClientRect (hTrayButton , & rcTrayButton );
187
196
MoveWindow (hTrayButton , ((mi .rcMonitor .right - mi .rcMonitor .left ) - (rcStart .right - rcStart .left )) / 2 + dwDim , rcStart .top , rcTrayButton .right , rcTrayButton .bottom , TRUE);
188
197
if (!bIsPrimaryTaskbar ) InvalidateRect (hTrayButton , NULL , TRUE);
189
198
dwDim += (rcTrayButton .right - rcTrayButton .left );
199
+ if (pCn == L"TrayDummySearchControl" ) {
200
+ pCn = L"TrayButton" ;
201
+ hTrayButton = NULL ;
202
+ }
190
203
}
191
204
}
192
205
else
@@ -196,13 +209,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
196
209
GetClientRect (hWndStart , & rcTrayButton );
197
210
DWORD dwDim = (rcTrayButton .bottom - rcTrayButton .top );
198
211
HWND hTrayButton = NULL ;
199
- while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , L"TrayButton" , NULL ))
212
+ wchar_t * pCn = L"TrayButton" ;
213
+ if (!IsWindows11 () && dwSearchboxTaskbarMode == 2 ) pCn = L"TrayDummySearchControl" ;
214
+ while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , pCn , NULL ))
200
215
{
201
- if (!IsWindowVisible (hTrayButton )) continue ;
216
+ if (pCn == L"TrayButton" && !IsWindowVisible (hTrayButton )) continue ;
202
217
GetClientRect (hTrayButton , & rcTrayButton );
203
218
MoveWindow (hTrayButton , rcStart .left , ((mi .rcMonitor .bottom - mi .rcMonitor .top ) - (rcStart .bottom - rcStart .top )) / 2 + dwDim , rcTrayButton .right , rcTrayButton .bottom , TRUE);
204
219
InvalidateRect (hTrayButton , NULL , TRUE);
205
220
dwDim += (rcTrayButton .bottom - rcTrayButton .top );
221
+ if (pCn == L"TrayDummySearchControl" ) {
222
+ pCn = L"TrayButton" ;
223
+ hTrayButton = NULL ;
224
+ }
206
225
}
207
226
}
208
227
if (!bIsPrimaryTaskbar ) InvalidateRect (hWndStart , NULL , TRUE);
@@ -310,13 +329,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
310
329
GetClientRect (hWndStart , & rcTrayButton );
311
330
DWORD dwDim = (rcTrayButton .right - rcTrayButton .left );
312
331
HWND hTrayButton = NULL ;
313
- while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , L"TrayButton" , NULL ))
332
+ wchar_t * pCn = L"TrayButton" ;
333
+ if (!IsWindows11 () && dwSearchboxTaskbarMode == 2 ) pCn = L"TrayDummySearchControl" ;
334
+ while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , pCn , NULL ))
314
335
{
315
- if (!IsWindowVisible (hTrayButton )) continue ;
336
+ if (pCn == L"TrayButton" && !IsWindowVisible (hTrayButton )) continue ;
316
337
GetClientRect (hTrayButton , & rcTrayButton );
317
338
MoveWindow (hTrayButton , (rc .left - mi .rcMonitor .left ) + lpRect -> left - (rcStart .right - rcStart .left ) + dwDim , rcStart .top , rcTrayButton .right , rcTrayButton .bottom , TRUE);
318
339
if (!bIsPrimaryTaskbar ) InvalidateRect (hTrayButton , NULL , TRUE);
319
340
dwDim += (rcTrayButton .right - rcTrayButton .left );
341
+ if (pCn == L"TrayDummySearchControl" ) {
342
+ pCn = L"TrayButton" ;
343
+ hTrayButton = NULL ;
344
+ }
320
345
}
321
346
}
322
347
else
@@ -326,13 +351,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
326
351
GetClientRect (hWndStart , & rcTrayButton );
327
352
DWORD dwDim = (rcTrayButton .bottom - rcTrayButton .top );
328
353
HWND hTrayButton = NULL ;
329
- while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , L"TrayButton" , NULL ))
354
+ wchar_t * pCn = L"TrayButton" ;
355
+ if (!IsWindows11 () && dwSearchboxTaskbarMode == 2 ) pCn = L"TrayDummySearchControl" ;
356
+ while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , pCn , NULL ))
330
357
{
331
- if (!IsWindowVisible (hTrayButton )) continue ;
358
+ if (pCn == L"TrayButton" && !IsWindowVisible (hTrayButton )) continue ;
332
359
GetClientRect (hTrayButton , & rcTrayButton );
333
360
MoveWindow (hTrayButton , rcStart .left , (rc .top - mi .rcMonitor .top ) + lpRect -> top - (rcStart .bottom - rcStart .top ) + dwDim , rcTrayButton .right , rcTrayButton .bottom , TRUE);
334
361
InvalidateRect (hTrayButton , NULL , TRUE);
335
362
dwDim += (rcTrayButton .bottom - rcTrayButton .top );
363
+ if (pCn == L"TrayDummySearchControl" ) {
364
+ pCn = L"TrayButton" ;
365
+ hTrayButton = NULL ;
366
+ }
336
367
}
337
368
}
338
369
if (!bIsPrimaryTaskbar ) InvalidateRect (hWndStart , NULL , TRUE);
@@ -442,9 +473,11 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
442
473
GetClientRect (hWndStart , & rcTrayButton );
443
474
DWORD dwDim = bIsTaskbarHorizontal ? (rcTrayButton .right - rcTrayButton .left ) : (rcTrayButton .bottom - rcTrayButton .top );
444
475
HWND hTrayButton = NULL ;
445
- while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , L"TrayButton" , NULL ))
476
+ wchar_t * pCn = L"TrayButton" ;
477
+ if (!IsWindows11 () && dwSearchboxTaskbarMode == 2 ) pCn = L"TrayDummySearchControl" ;
478
+ while (hTrayButton = FindWindowExW (hWndTaskbar , hTrayButton , pCn , NULL ))
446
479
{
447
- if (!IsWindowVisible (hTrayButton )) continue ;
480
+ if (pCn == L"TrayButton" && !IsWindowVisible (hTrayButton )) continue ;
448
481
GetClientRect (hTrayButton , & rcTrayButton );
449
482
if (bIsTaskbarHorizontal )
450
483
{
@@ -456,6 +489,10 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
456
489
}
457
490
if (!bIsPrimaryTaskbar || !bIsTaskbarHorizontal ) InvalidateRect (hTrayButton , NULL , TRUE);
458
491
dwDim += bIsTaskbarHorizontal ? (rcTrayButton .right - rcTrayButton .left ) : (rcTrayButton .bottom - rcTrayButton .top );
492
+ if (pCn == L"TrayDummySearchControl" ) {
493
+ pCn = L"TrayButton" ;
494
+ hTrayButton = NULL ;
495
+ }
459
496
}
460
497
}
461
498
}
0 commit comments