@@ -149,7 +149,9 @@ void OnDocComplete(std::wstring path, DWORD threadID)
149
149
// std::wcout << L"path[" << threadID << L"] " << path << L"\n";
150
150
auto iter = m_DUIList.find (threadID);
151
151
if (iter != m_DUIList.end ())
152
- iter->second .path = path;
152
+ {
153
+ iter->second .path = std::move (path);
154
+ }
153
155
}
154
156
155
157
@@ -244,10 +246,12 @@ namespace Hook
244
246
bool IsExcludePath ()
245
247
{
246
248
auto iter = m_DUIList.find (GetCurrentThreadId ());
247
- if (iter != m_DUIList.end ())
249
+ if (iter == m_DUIList.end ()) return true ;
250
+ if (iter->second .mainWnd == nullptr )
248
251
{
249
- if (iter->second .path .find (L" ::{26EE0668-A00A-44D7-9371-BEB064C98683}" ) != std::wstring::npos)
250
- return true ;
252
+ /* if (iter->second.path.find(L"::{26EE0668-A00A-44D7-9371-BEB064C98683}") != std::wstring::npos)
253
+ return true;*/
254
+ return true ;
251
255
}
252
256
return false ;
253
257
}
@@ -434,29 +438,29 @@ namespace Hook
434
438
if (ClassName == L" DirectUIHWND" && GetWindowClassName (hWndParent) == L" SHELLDLL_DefView" )
435
439
{
436
440
// 继续查找父级
437
- HWND parent = GetParent (hWndParent);
438
- if (GetWindowClassName (parent) == L" ShellTabWindowClass" )
441
+ if (GetWindowClassName (hWndParent) == L" ShellTabWindowClass" )
439
442
{
440
- parent = GetParent (parent);
441
-
442
- // 设置Blur
443
- SetWindowBlur (parent);
444
-
445
- // 22H2
446
- if (g_sysBuildNumber >= 22500 )
447
- {
448
- SetWindowSubclass (parent, MyWndSubProc, 0 , (DWORD_PTR)0 );
449
- }
450
-
451
443
// 记录到列表中 Add to list
452
444
DWORD tid = GetCurrentThreadId ();
445
+ m_DUIList[tid].hWnd = hWnd;
446
+ }
447
+ }
448
+ // 查找主窗口
449
+ else if (ClassName == L" SHELLDLL_DefView" && GetWindowClassName (hWndParent) == L" ShellTabWindowClass" )
450
+ {
451
+ HWND mainWnd = GetParent (hWndParent);
452
+ // 设置Blur
453
+ SetWindowBlur (mainWnd);
453
454
454
- DUIData data;
455
- data.hWnd = hWnd;
456
- data.mainWnd = parent;
457
-
458
- m_DUIList[tid] = data;
455
+ // 22H2
456
+ if (g_sysBuildNumber >= 22500 )
457
+ {
458
+ SetWindowSubclass (mainWnd, MyWndSubProc, 0 , (DWORD_PTR)0 );
459
459
}
460
+
461
+ // 记录到列表中 Add to list
462
+ DWORD tid = GetCurrentThreadId ();
463
+ m_DUIList[tid].mainWnd = mainWnd;
460
464
}
461
465
// 导航树视图
462
466
else if (ClassName == L" SysTreeView32" )
@@ -567,10 +571,7 @@ namespace Hook
567
571
}
568
572
return ret;
569
573
}
570
- else
571
- goto Next;
572
574
}
573
- Next:
574
575
// 透明化 Windows 10 Ribbon 在Light模式
575
576
auto ribiter = m_ribbonPaint.find (curThread);
576
577
if (ribiter != m_ribbonPaint.end ())
@@ -708,7 +709,7 @@ namespace Hook
708
709
709
710
thread_local bool isCurThread = false ;
710
711
711
- if (!IsExcludePath () && !(option & ETO_GLYPH_INDEX) && !(option & ETO_IGNORELANGUAGE)
712
+ if (!IsExcludePath () && !( CheckCaller ( L" msctf.dll " )) && !(option & ETO_GLYPH_INDEX) && !(option & ETO_IGNORELANGUAGE)
712
713
&& !isCurThread && !str.empty () && m_drawtextState.find (GetCurrentThreadId ()) == m_drawtextState.end ())
713
714
{
714
715
isCurThread = true ;
@@ -732,17 +733,13 @@ namespace Hook
732
733
IntersectClipRect (hdc, rect.left , rect.top , rect.right , rect.bottom );
733
734
}
734
735
735
- HRESULT hr = S_OK;
736
- HDC hDC = 0 ;
737
- DTTOPTS dtop = { 0 };
738
- dtop.dwSize = sizeof (DTTOPTS);
739
- dtop.dwFlags = DTT_COMPOSITED | DTT_TEXTCOLOR | DTT_CALLBACK;
740
- dtop.crText = GetTextColor (hdc);
741
- dtop.pfnDrawTextCallback = [](HDC hdc, LPWSTR lpchText, int cchText, LPRECT lprc, UINT format, LPARAM lParam)
736
+ COLORREF crText = GetTextColor (hdc);
737
+ auto callback = [](HDC hdc, LPWSTR lpchText, int cchText, LPRECT lprc, UINT format, LPARAM lParam)
742
738
{
743
739
return _DrawTextW_.Org (hdc, lpchText, cchText, lprc, format);
744
740
};
745
741
742
+ HRESULT hr = S_OK;
746
743
// 合批绘制文本
747
744
auto fun = [&](HDC hDC) {
748
745
HTHEME hTheme = OpenThemeData ((HWND)0 , L" Menu" );
@@ -771,7 +768,7 @@ namespace Hook
771
768
{
772
769
// 先绘制上一批
773
770
hr = DrawTextWithGlow (hDC, batchStr.c_str (), (int )batchStr.length (), &batchRc, DT_LEFT | DT_TOP | DT_SINGLELINE,
774
- dtop. crText , 0 , 0 , 0 , 0 , dtop. pfnDrawTextCallback , 0 );
771
+ crText, 0 , 0 , 0 , 0 , callback , 0 );
775
772
// hr = _DrawThemeTextEx_.Org(hTheme, hDC, 0, 0, batchStr.c_str(), batchStr.length(), DT_LEFT | DT_TOP | DT_SINGLELINE, &batchRc, &dtop);
776
773
777
774
batch = false ;
@@ -785,7 +782,7 @@ namespace Hook
785
782
if (i == c - 1 )
786
783
{
787
784
hr = DrawTextWithGlow (hDC, batchStr.c_str (), (int )batchStr.length (), &batchRc, DT_LEFT | DT_TOP | DT_SINGLELINE,
788
- dtop. crText , 0 , 0 , 0 , 0 , dtop. pfnDrawTextCallback , 0 );
785
+ crText, 0 , 0 , 0 , 0 , callback , 0 );
789
786
// hr = _DrawThemeTextEx_.Org(hTheme, hDC, 0, 0, batchStr.c_str(), batchStr.length(), DT_LEFT | DT_TOP | DT_SINGLELINE, &batchRc, &dtop);
790
787
}
791
788
@@ -839,10 +836,11 @@ namespace Hook
839
836
)
840
837
{
841
838
HRESULT ret = _GetThemeColor_.Org (hTheme, iPartId, iStateId, iPropId, pColor);
839
+
842
840
std::wstring kname = GetThemeClassName (hTheme);
843
841
844
842
// 将主要控件的背景色设置为黑色 以供API透明化Blur效果
845
- if (iPropId == TMT_FILLCOLOR && ! IsExcludePath () )
843
+ if (iPropId == TMT_FILLCOLOR)
846
844
{
847
845
// DUI视图、底部状态栏、导航栏
848
846
if (((kname == L" ItemsView" || kname == L" ExplorerStatusBar" || kname == L" ExplorerNavPane" )
@@ -907,13 +905,16 @@ namespace Hook
907
905
LPCRECT pRect,
908
906
LPCRECT pClipRect)
909
907
{
910
- std::wstring kname = GetThemeClassName (hTheme);
911
-
912
- if (kname == L" Rebar" && (iPartId == RP_BACKGROUND || iPartId == RP_BAND) && iStateId == 0 )
908
+ if (!IsExcludePath ())
913
909
{
914
- return S_OK;
915
- }
910
+ std::wstring kname = GetThemeClassName (hTheme);
916
911
912
+ if (kname == L" Rebar" && (iPartId == RP_BACKGROUND || iPartId == RP_BAND) && iStateId == 0 )
913
+ {
914
+ FillRect (hdc, pRect, m_clearBrush);
915
+ return S_OK;
916
+ }
917
+ }
917
918
return _DrawThemeBackground_.Org (hTheme, hdc, iPartId, iStateId, pRect, pClipRect);
918
919
}
919
920
@@ -926,9 +927,12 @@ namespace Hook
926
927
const DTBGOPTS* pOptions
927
928
)
928
929
{
929
- std::wstring kname = GetThemeClassName (hTheme);
930
930
if (!IsExcludePath ())
931
931
{
932
+ std::wstring kname = GetThemeClassName (hTheme);
933
+
934
+ // std::wcout << kname << L" p:" << iPartId << L" s:" << iStateId << std::endl;
935
+
932
936
// Blur模式下 透明化 Header、Rebar、预览面板、命令模块
933
937
if (kname == L" Header" ) {
934
938
if ((iPartId == HP_HEADERITEM && iStateId == HIS_NORMAL)
@@ -940,6 +944,7 @@ namespace Hook
940
944
{
941
945
if ((iPartId == RP_BACKGROUND || iPartId == RP_BAND) && iStateId == 0 )
942
946
{
947
+ FillRect (hdc, pRect, m_clearBrush);
943
948
return S_OK;
944
949
}
945
950
}
@@ -952,12 +957,19 @@ namespace Hook
952
957
{
953
958
if (iPartId == 1 && iStateId == 0 ) {
954
959
960
+ FillRect (hdc, pRect, m_clearBrush);
961
+ return S_OK;
962
+ }
963
+ }
964
+ else if (kname == L" ControlPanel" )
965
+ {
966
+ if (iPartId == 2 && iStateId == 0 ) {
967
+
955
968
FillRect (hdc, pRect, m_clearBrush);
956
969
return S_OK;
957
970
}
958
971
}
959
972
}
960
- End:
961
973
return _DrawThemeBackgroundEx_.Org (hTheme, hdc, iPartId, iStateId, pRect, pOptions);
962
974
}
963
975
}
0 commit comments