Howdy, Stranger!

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

Categories

positioning modeless dialog box in center of app??

grahamojgrahamoj Member Posts: 366
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

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [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]
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ______ \ http://forcoder.org \ free ebooks and video tutorials about \ C++, Ruby, Swift, Java, Delphi, Scratch, Objective-C, MATLAB, Go, Visual Basic, PL/SQL, C, C#, Visual Basic .NET, Assembly, PHP, Perl, R, JavaScript, Python Lua, Apex, Logo, ML, LabVIEW, FoxPro, Kotlin, Ada, Prolog, Clojure, Bash, COBOL, VBScript, Scala, Lisp, Fortran, Erlang, Scheme, Alice, Rust, D, Crystal, Julia, ABAP, F#, SAS, Dart, Hack, Transact-SQL, Awk \ ____

Sign In or Register to comment.