aboutsummaryrefslogtreecommitdiff
path: root/CPP/7zip/UI/FileManager/FM.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CPP/7zip/UI/FileManager/FM.cpp108
1 files changed, 103 insertions, 5 deletions
diff --git a/CPP/7zip/UI/FileManager/FM.cpp b/CPP/7zip/UI/FileManager/FM.cpp
index 13189a7..fe4f2bd 100644
--- a/CPP/7zip/UI/FileManager/FM.cpp
+++ b/CPP/7zip/UI/FileManager/FM.cpp
@@ -48,6 +48,10 @@ using namespace NFind;
48// #define MAX_LOADSTRING 100 48// #define MAX_LOADSTRING 100
49 49
50extern 50extern
51bool g_DisableUserQuestions;
52bool g_DisableUserQuestions;
53
54extern
51bool g_RAM_Size_Defined; 55bool g_RAM_Size_Defined;
52bool g_RAM_Size_Defined; 56bool g_RAM_Size_Defined;
53 57
@@ -78,8 +82,9 @@ void FreeGlobalCodecs();
78 82
79#ifndef UNDER_CE 83#ifndef UNDER_CE
80 84
81extern 85#ifdef Z7_USE_DYN_ComCtl32Version
82DWORD g_ComCtl32Version; 86Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION
87
83DWORD g_ComCtl32Version; 88DWORD g_ComCtl32Version;
84 89
85static DWORD GetDllVersion(LPCTSTR dllName) 90static DWORD GetDllVersion(LPCTSTR dllName)
@@ -107,6 +112,7 @@ static DWORD GetDllVersion(LPCTSTR dllName)
107} 112}
108 113
109#endif 114#endif
115#endif
110 116
111bool g_IsSmallScreen = false; 117bool g_IsSmallScreen = false;
112 118
@@ -202,7 +208,36 @@ static const wchar_t * const kWindowClass = L"7-Zip::FM";
202 WS_MAXIMIZEBOX) 208 WS_MAXIMIZEBOX)
203#endif 209#endif
204 210
205// FUNCTION: InitInstance(HANDLE, int) 211
212/*
213typedef HRESULT (WINAPI *Func_SetWindowTheme)(
214 HWND hwnd,
215 LPCWSTR pszSubAppName,
216 LPCWSTR pszSubIdList
217);
218
219typedef BOOL (WINAPI *Func_AllowDarkModeForWindow)(
220 HWND a_HWND, BOOL a_Allow);
221
222enum PreferredAppMode
223{
224 Default,
225 AllowDark,
226 ForceDark,
227 ForceLight,
228 Max
229};
230// ordinal 135, in 1903
231typedef BOOL (WINAPI *Func_SetPreferredAppMode)(PreferredAppMode appMode);
232
233typedef HRESULT (WINAPI *Func_DwmSetWindowAttribute)(
234 HWND hwnd,
235 DWORD dwAttribute,
236 LPCVOID pvAttribute,
237 DWORD cbAttribute
238);
239*/
240
206static BOOL InitInstance(int nCmdShow) 241static BOOL InitInstance(int nCmdShow)
207{ 242{
208 CWindow wnd; 243 CWindow wnd;
@@ -293,6 +328,69 @@ static BOOL InitInstance(int nCmdShow)
293 x, y, xSize, ySize, NULL, NULL, g_hInstance, NULL)) 328 x, y, xSize, ySize, NULL, NULL, g_hInstance, NULL))
294 return FALSE; 329 return FALSE;
295 330
331 /*
332 // doesn't work
333 {
334 const HMODULE hmodule = LoadLibrary("UxTheme.dll");
335 if (hmodule)
336 {
337 {
338 const
339 Func_AllowDarkModeForWindow f = Z7_GET_PROC_ADDRESS(
340 Func_AllowDarkModeForWindow, hmodule,
341 MAKEINTRESOURCEA(133));
342 if (f)
343 {
344 BOOL res = f((HWND)wnd, TRUE);
345 res = res;
346 }
347 }
348 {
349 const
350 Func_SetPreferredAppMode f = Z7_GET_PROC_ADDRESS(
351 Func_SetPreferredAppMode, hmodule,
352 MAKEINTRESOURCEA(135));
353 if (f)
354 {
355 f(ForceDark);
356 }
357 }
358 {
359 const
360 Func_SetWindowTheme f = Z7_GET_PROC_ADDRESS(
361 Func_SetWindowTheme, hmodule,
362 "SetWindowTheme");
363 if (f)
364 {
365 // HRESULT hres = f((HWND)wnd, L"DarkMode_Explorer", NULL);
366 HRESULT hres = f((HWND)wnd, L"Explorer", NULL);
367 hres = hres;
368 }
369 }
370 FreeLibrary(hmodule);
371 }
372 }
373 {
374 const HMODULE hmodule = LoadLibrary("Dwmapi.dll");
375 if (hmodule)
376 {
377 const
378 Func_DwmSetWindowAttribute f = Z7_GET_PROC_ADDRESS(
379 Func_DwmSetWindowAttribute, hmodule,
380 "DwmSetWindowAttribute");
381 if (f)
382 {
383 #ifndef Z7_WIN_DWMWA_USE_IMMERSIVE_DARK_MODE
384 #define Z7_WIN_DWMWA_USE_IMMERSIVE_DARK_MODE 20
385 #endif
386 BOOL value = TRUE;
387 f((HWND)wnd, Z7_WIN_DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value));
388 }
389 FreeLibrary(hmodule);
390 }
391 }
392 */
393
296 if (nCmdShow == SW_SHOWNORMAL || 394 if (nCmdShow == SW_SHOWNORMAL ||
297 nCmdShow == SW_SHOW 395 nCmdShow == SW_SHOW
298 #ifndef UNDER_CE 396 #ifndef UNDER_CE
@@ -519,10 +617,10 @@ static int WINAPI WinMain2(int nCmdShow)
519 617
520 InitCommonControls(); 618 InitCommonControls();
521 619
522 #ifndef UNDER_CE 620#ifdef Z7_USE_DYN_ComCtl32Version
523 g_ComCtl32Version = ::GetDllVersion(TEXT("comctl32.dll")); 621 g_ComCtl32Version = ::GetDllVersion(TEXT("comctl32.dll"));
524 g_LVN_ITEMACTIVATE_Support = (g_ComCtl32Version >= MAKELONG(71, 4)); 622 g_LVN_ITEMACTIVATE_Support = (g_ComCtl32Version >= MAKELONG(71, 4));
525 #endif 623#endif
526 624
527 #if defined(_WIN32) && !defined(_WIN64) && !defined(UNDER_CE) 625 #if defined(_WIN32) && !defined(_WIN64) && !defined(UNDER_CE)
528 Set_Wow64(); 626 Set_Wow64();