Click to See Complete Forum and Search --> : [RESOLVED] No Move Dialog
motobizio
July 26th, 2010, 10:05 AM
Hello to all
I am trying to make a No-Move dialog.
This is my 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!
VictorN
July 26th, 2010, 10:18 AM
Check out this (http://www.codeguru.com/forum/showthread.php?t=439843&highlight=WM_WINDOWPOSCHANGING) thread
Igor Vartanov
July 26th, 2010, 10:59 AM
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.
motobizio
July 27th, 2010, 06:38 AM
Ok, ok
Thanks to all of you for your precious help.
I solved the situation by the following way:
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!!
VictorN
July 27th, 2010, 07:04 AM
I solved the situation by the following way:
int CALLBACK DlgProc(......)
switch (message) {
.....
.....
case WM_NCHITTEST :
return HTCLIENT ;
break ;
.......
}
No, you failed to solve it! :eek:
Your window can be moved using sys menu "move" + either mouse or any arrow key.
Please, check out this (http://www.codeguru.com/forum/showthread.php?t=422861&highlight=OnWindowPosChanging) thread.
motobizio
July 27th, 2010, 07:53 AM
No, you failed to solve it! :eek:
Your window can be moved using sys menu "move" + either mouse or any arrow key.
Please, check out this (http://www.codeguru.com/forum/showthread.php?t=422861&highlight=OnWindowPosChanging) thread.
You are right. I forgot to say that, in WM_INITDIALOG, I disabled SYSMENU.
Thank you !
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.