浏览代码

Windows: Center dialogs

bel2125 5 年之前
父节点
当前提交
bd9ad589d4
共有 1 个文件被更改,包括 20 次插入15 次删除
  1. 20 15
      src/main.c

+ 20 - 15
src/main.c

@@ -1573,13 +1573,16 @@ struct dlg_proc_param {
 };
 };
 
 
 struct dlg_header_param {
 struct dlg_header_param {
+	/* https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-dlgtemplate
+	 */
 	DLGTEMPLATE dlg_template; /* 18 bytes */
 	DLGTEMPLATE dlg_template; /* 18 bytes */
 	WORD menu, dlg_class;
 	WORD menu, dlg_class;
 	wchar_t caption[1];
 	wchar_t caption[1];
-	WORD fontsiz;
+	WORD fontsize;
 	wchar_t fontface[7];
 	wchar_t fontface[7];
 };
 };
 
 
+
 static struct dlg_header_param
 static struct dlg_header_param
 GetDlgHeader(const short width)
 GetDlgHeader(const short width)
 {
 {
@@ -1589,26 +1592,28 @@ GetDlgHeader(const short width)
 #pragma warning(disable : 4204)
 #pragma warning(disable : 4204)
 #endif /* if defined(_MSC_VER) */
 #endif /* if defined(_MSC_VER) */
 
 
-	struct dlg_header_param dialog_header = {{WS_CAPTION | WS_POPUP | WS_SYSMENU
-	                                              | WS_VISIBLE | DS_SETFONT
-	                                              | WS_DLGFRAME,
-	                                          WS_EX_TOOLWINDOW,
-	                                          0,
-	                                          /* x */ 100,
-	                                          /* y */ 30,
-	                                          width,
-	                                          /* height: to be calculated */ 0},
-	                                         0,
-	                                         0,
-	                                         L"",
-	                                         8,
-	                                         L"Tahoma"};
+	struct dlg_header_param dialog_header = {
+	    /* DLGTEMPLATE */
+	    {/* style */ WS_CAPTION | WS_POPUP | WS_SYSMENU | WS_VISIBLE
+	         | DS_SETFONT | DS_CENTER | WS_DLGFRAME,
+	     /* extstyle */ WS_EX_TOOLWINDOW,
+	     /* cdit */ 0,
+	     /* x ignored by DS_CENTER */ 0,
+	     /* y ignored by DS_CENTER */ 0,
+	     width,
+	     /* height - to be calculated */ 0},
+	    /* menu */ 0,
+	    /* dlg_class */ 0,
+	    /* caption */ L"",
+	    /* fontsize */ 8,
+	    /* font */ L"Tahoma"};
 #if defined(_MSC_VER)
 #if defined(_MSC_VER)
 #pragma warning(pop)
 #pragma warning(pop)
 #endif /* if defined(_MSC_VER) */
 #endif /* if defined(_MSC_VER) */
 	return dialog_header;
 	return dialog_header;
 }
 }
 
 
+
 /* Dialog proc for settings dialog */
 /* Dialog proc for settings dialog */
 static INT_PTR CALLBACK
 static INT_PTR CALLBACK
 SettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 SettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)