[Issue 21655] New: win32 dialog app, main dialog box is not centered
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 22 09:16:27 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21655
Issue ID: 21655
Summary: win32 dialog app, main dialog box is not centered
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: top398 at 139.com
A simple win32 dialog app, compiled by DMD 2.095.1, the dialog box is showed at
upper-left of desktop when startup, but compiled by LDC 1.24.0 one centered.
import core.sys.windows.windows;
import core.runtime;
enum { IDD_DIALOG1 = 100, }
HINSTANCE hiApp;
HWND hwDlg;
extern (Windows) nothrow @system
INT_PTR DlgProc(HWND hw, UINT wm, WPARAM wp, LPARAM lp) {
switch(wm) {
case WM_INITDIALOG:
hwDlg = hw;
return TRUE;
case WM_CLOSE:
EndDialog(hw, 0);
return TRUE;
default:
break;
}
return FALSE;
}
extern (Windows)
INT_PTR WinMain(HINSTANCE hiThis, HINSTANCE hiPrev, LPSTR psArg, int iShow) {
Runtime.initialize();
hiApp = hiThis;
INT_PTR res = DialogBox(hiApp, MAKEINTRESOURCE(IDD_DIALOG1), NULL, &DlgProc);
Runtime.terminate();
return res;
}
--
More information about the Digitalmars-d-bugs
mailing list