positioning modeless dialog box in center of app??

hiya how do u position a modeless dialog box in the centre of an application??

i use the lines:

m_pModeLess->Create(IDD_MODELESS,GetDesktopWindow() );

thanks,
grahamoj.

Comments

  • [b][red]This message was edited by AsmGuru62 at 2002-10-16 7:33:29[/red][/b][hr]
    : hiya how do u position a modeless dialog box in the centre of an application??
    :
    : i use the lines:
    :
    : m_pModeLess->Create(IDD_MODELESS,GetDesktopWindow() );
    :
    : thanks,
    : grahamoj.
    :
    [code]
    [b]#define[/b] WRECT(rc) (rc.right - rc.left)
    [b]#define[/b] HRECT(rc) (rc.bottom - rc.top)

    [b]HWND[/b] hDlgParent = ...; // Get it somehow
    [b]HWND[/b] hDlg = ...; // Get it somehow
    [b]RECT[/b] rcParent, rcDlg;

    GetWindowRect (hDlgParent, &rcParent);
    GetWindowRect (hDlg, &rcDlg);

    MoveWindow (hDlg,
    rcParent.left + (WRECT (rcParent) - WRECT (rcDlg))/2,
    rcParent.top + (HRECT (rcParent) - HRECT (rcDlg))/2,
    WRECT (rcDlg), HRECT (rcDlg), TRUE);
    [/code]

    [blue]It was Win32 API - Of course, you can 'transfer' it all to MFC... just use the idea...[/blue]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion