www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21655] New: win32 dialog app, main dialog box is not centered

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 puremagic.com
          Reporter: top398 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;
}

--
Feb 22