CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2009
    Location
    Genova - Italy
    Posts
    38

    [RESOLVED] No Move Dialog

    Hello to all
    I am trying to make a No-Move dialog.
    This is my code:
    Code:
    hWndDlg= CreateDialog(hInstance, MAKEINTRESOURCE(IDD_CREAREQ), hWnd, (DLGPROC) DlgCreaReqProc) ;
    ShowWindow(hWndDlg, SW_SHOW);
    UpdateWindow(hWndDlg);
    SetWindowPos(hWndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
    The dialog keep on moving when I drag it with mouse!

    Someone can help me?

    Thank you!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: No Move Dialog

    Check out this thread
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: No Move Dialog

    SetWindowPos(hWndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
    Nice joke, man.

    FYI, SWP_NOMOVE means here: this SetWindowPos call is not intended for moving this window, so all position parameters must be ignored. All what this call does is it changes the window Z-order. It does not put any restrictions on windows abilities to move and re-size.
    Last edited by Igor Vartanov; July 26th, 2010 at 03:23 PM.
    Best regards,
    Igor

  4. #4
    Join Date
    Jul 2009
    Location
    Genova - Italy
    Posts
    38

    Talking Re: No Move Dialog

    Ok, ok

    Thanks to all of you for your precious help.

    I solved the situation by the following way:

    Code:
    int CALLBACK DlgProc(......)
    
       switch (message) {
          .....
          .....
          case WM_NCHITTEST :
              return HTCLIENT ;
              break ;
          .......
       }
    By this way, the mouse appears to be into the dialog even if the mouse is put on the title bar.

    Thank you very much!!

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: No Move Dialog

    Quote Originally Posted by motobizio View Post
    I solved the situation by the following way:

    Code:
    int CALLBACK DlgProc(......)
    
       switch (message) {
          .....
          .....
          case WM_NCHITTEST :
              return HTCLIENT ;
              break ;
          .......
       }
    No, you failed to solve it!
    Your window can be moved using sys menu "move" + either mouse or any arrow key.
    Please, check out this thread.
    Victor Nijegorodov

  6. #6
    Join Date
    Jul 2009
    Location
    Genova - Italy
    Posts
    38

    Re: No Move Dialog

    Quote Originally Posted by VictorN View Post
    No, you failed to solve it!
    Your window can be moved using sys menu "move" + either mouse or any arrow key.
    Please, check out this thread.
    You are right. I forgot to say that, in WM_INITDIALOG, I disabled SYSMENU.

    Thank you !

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