CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2002
    Location
    China
    Posts
    102

    How can I make a dialog NOMOVE?

    How can I make a dialog NOMOVE? When you drag mouse on titlebar, the dialog do not move.

  2. #2
    Join Date
    Aug 2001
    Location
    Sydney, Australia
    Posts
    813
    If its a dialog you created through the resource editor, in its create function (or similar) try something like:

    SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

    or, just get rid of the title bar and use something else in its stead
    Microsoft LVP - Least Valuable Professional

    Please rate this post... Pleeeeeeaaassee!!!

  3. #3
    Join Date
    Nov 2002
    Location
    Los Angeles, California
    Posts
    3,863
    PHP Code:
    UINT CYOURDialog::OnNcHitTest(CPoint point
    {
        
        
    UINT ret CDialog::OnNcHitTest(point);
        if(
    HTCAPTION == ret)
            return 
    HTCLIENT;
        return 
    ret;

    Wakeup in the morning and kick the day in the teeth!! Or something like that.

    "i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."

  4. #4
    Join Date
    Nov 2002
    Location
    Israel
    Posts
    182
    What I know about it you can remove the caption - that's the window style you can remove it using ModifyStyle function. Or if you like the caption you can play with WM_SIZE or better with WM_WINDOWPOSCHANGED, WM_WINDOWPOSCHANGING. You can add:
    BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
    //{{AFX_MSG_MAP(CTestDlg)
    ON_WM_WINDOWPOSCHANGED()
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()

    and so on. You can find this macros(ON_WM_WINDOWPOSCHANGED) in MSDN to take the message handler prototype from there, something like afx_msg LRESULT OnWindowPosChanged(LPWINDOWPOSSTRUCT ... - sorry, I never remember such things and always copy them from MSDN topics.
    Good luck

  5. #5
    Join Date
    Nov 2002
    Location
    Los Angeles, California
    Posts
    3,863
    I have already posted the simplest way to do it.
    Wakeup in the morning and kick the day in the teeth!! Or something like that.

    "i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."

  6. #6
    Join Date
    Feb 2002
    Location
    China
    Posts
    102
    Thank you all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured