DXGL r812 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r811‎ | r812 | r813 >
Date:01:08, 13 May 2018
Author:admin
Status:new
Tags:
Comment:
Add a simple loading dialog.
Modified paths:
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/dxglcfg.rc (modified) (history)
  • /dxglcfg/resource.h (modified) (history)

Diff [purge]

Index: dxglcfg/dxglcfg.cpp
@@ -2514,6 +2514,29 @@
25152515 return level;
25162516 }
25172517
 2518+LRESULT CALLBACK LoadingCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 2519+{
 2520+ HWND *hWndReturn = (HWND*)lParam;
 2521+ switch (Msg)
 2522+ {
 2523+ case WM_INITDIALOG:
 2524+ *hWndReturn = hWnd;
 2525+ return TRUE;
 2526+ case WM_USER+1:
 2527+ DestroyWindow(hWnd);
 2528+ return TRUE;
 2529+ default:
 2530+ return FALSE;
 2531+ }
 2532+}
 2533+
 2534+DWORD WINAPI ProgressThread(LPVOID hWndOut)
 2535+{
 2536+ DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_LOADING), NULL, (DLGPROC)LoadingCallback, (LPARAM)hWndOut);
 2537+ ExitThread(0);
 2538+ return 0;
 2539+}
 2540+
25182541 LRESULT CALLBACK DXGLCfgCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
25192542 {
25202543 PIXELFORMATDESCRIPTOR pfd =
@@ -2583,9 +2606,14 @@
25842607 int newtab;
25852608 DWORD dpisupport;
25862609 TCITEM tab;
 2610+ int progresscount;
 2611+ HWND hProgressWnd;
25872612 switch (Msg)
25882613 {
25892614 case WM_INITDIALOG:
 2615+ hProgressWnd = NULL;
 2616+ CreateThread(NULL, 0, ProgressThread, &hProgressWnd, 0, NULL);
 2617+ while (hProgressWnd == NULL) Sleep(10);
25902618 hDialog = hWnd;
25912619 tristate = FALSE;
25922620 maxapps = 128;
@@ -3216,6 +3244,7 @@
32173245 // Add installed programs
32183246 current_app = 1;
32193247 appcount = 1;
 3248+ progresscount = 1;
32203249 regbuffersize = 1024;
32213250 regbuffer = (LPTSTR)malloc(regbuffersize * sizeof(TCHAR));
32223251 RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\DXGL\\Profiles"), 0, NULL, 0, KEY_READ, NULL, &hKeyBase, NULL);
@@ -3225,6 +3254,9 @@
32263255 keysize2 = keysize;
32273256 i = 0;
32283257 while (RegEnumKeyEx(hKeyBase, i, keyname, &keysize2, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
 3258+ progresscount++;
 3259+ i = 0;
 3260+ while (RegEnumKeyEx(hKeyBase, i, keyname, &keysize2, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
32293261 {
32303262 keysize2 = keysize;
32313263 i++;
@@ -3360,6 +3392,8 @@
33613393 EnableWindow(GetDlgItem(hTabs[0], IDC_DPISCALE), FALSE);
33623394 }
33633395 if(token) CloseHandle(token);
 3396+ SendMessage(hProgressWnd, WM_USER+1, 0, 0);
 3397+ SetForegroundWindow(hWnd);
33643398 return TRUE;
33653399 case WM_MEASUREITEM:
33663400 switch(wParam)
Index: dxglcfg/dxglcfg.rc
@@ -243,13 +243,16 @@
244244
245245
246246 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
247 -IDD_LOADING DIALOG 0, 0, 246, 41
248 -STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_POPUP | WS_SYSMENU
249 -EXSTYLE WS_EX_WINDOWEDGE
 247+//IDD_LOADING DIALOG 0, 0, 246, 41
 248+IDD_LOADING DIALOG 0, 0, 68, 18
 249+STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_POPUP
 250+EXSTYLE WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW
 251+CAPTION "DXGL Config"
250252 FONT 8, "Ms Shell Dlg"
251253 {
252 - LTEXT "Loading profiles...", 0, 95, 10, 56, 8, SS_LEFT, WS_EX_LEFT
253 - CONTROL "", IDC_PROGRESS, PROGRESS_CLASS, 0, 7, 20, 232, 14, WS_EX_LEFT
 254+// LTEXT "Loading profiles...", 0, 95, 10, 56, 8, SS_LEFT, WS_EX_LEFT
 255+// CONTROL "", IDC_PROGRESS, PROGRESS_CLASS, 0, 7, 20, 232, 14, WS_EX_LEFT
 256+ LTEXT "Please wait...", 0, 13, 4, 43, 9, SS_LEFT, WS_EX_LEFT
254257 }
255258
256259
Index: dxglcfg/resource.h
@@ -54,7 +54,7 @@
5555 #define IDB_DXGLINV64 312
5656
5757 // Controls - Progress Dialog
58 -#define IDC_PROGRESS 1101
 58+//#define IDC_PROGRESS 1101
5959
6060 // Controls - Display Tab
6161 #define IDC_VIDMODE 2001