|
-
June 10th, 1999, 10:06 AM
#1
Prevent Window Move
Hi:
Can anyone tell me how to prevent Window Move ?
I am trapping the ON_WM_MOVING() message and in my "void OnMoving(UINT fwSide, LPRECT pRect)" do NOT call the base class "CPropertySheet::OnMoving(fwSide, pRect);" the window still moves. How do I prevent window move?
Thank you.
-
June 10th, 1999, 11:45 AM
#2
Re: Prevent Window Move
Did you try OnGetMinMaxInfo()?
-
June 10th, 1999, 12:12 PM
#3
Re: Prevent Window Move
My favorite method is to override OnNcHitTest.
You can fake windoze into thinking the mouse NEVER hits the title
area and therefore the window can't be moved. This applies to
resizing also. Check the docs for more details.
-
June 10th, 1999, 02:27 PM
#4
Re: Prevent Window Move
Thank you for your suggestion. It works fine for my CDialog.
But, how can I do similar stuff for "CView".
What can I override to prevent move and resize of view ?
-
June 10th, 1999, 02:42 PM
#5
Re: Prevent Window Move
Overriding OnNcHitTest will work for views also.
It is a bit better suited for main frames but will work
for child frames because there more issues to watch
out for with MDI like cascade and tile of multiple views.
I have used this with SDI apps successfully and I used
it on an MDI app where each view was derived from
CFormView and I locked out resizing and moving of
the child frames and left moving of the main frame
enabled.
-
June 10th, 1999, 03:17 PM
#6
Re: Prevent Window Move
I tried it. My class is derived from CView and "OnNcHitTest(CPoint point)" is called only when the mouse is in the client area ( when OnNcHitTest() returns HTCLIENT ). When the mouse is anywhere else( title bar, min/max buttons ) this message handler is not called at all. What can I do to correct this?
-
June 11th, 1999, 01:23 AM
#7
Re: Prevent Window Move
Did you do it in CChildFrame?????
(or in your view, that only fills the client area of the child frame)
chrislaw
-
June 11th, 1999, 03:59 PM
#8
Re: Prevent Window Move
Hi, that was exactly where I was doing it and hence the problem. I moved the code to CChildFrame and it works perfect.
Thank you.
-
June 11th, 1999, 05:36 PM
#9
Re: Prevent Window Move
I am glad to hear that you have it working.
I apologize if I misled you. Although my post
did mention child frames, I wasn't clear on
saying that the check needs to be in the frame
class, not the view class. Again, I apologize.
-
June 13th, 1999, 05:33 PM
#10
Re: Prevent Window Move
This is a little off topic, but you said you use this method to prevent resizing of a window too why??? Simply removing the WS_THICKFRAME from your window class prevents resizing!!! For example you can remove the WS_THICKFRAME style from an appwizard generated project by adding
cs.style &= ~WS_THICKFRAME;
to the CMainFrame's PreCreateWindow function. If you want to constrain a window to a specific size you can override the OnGetMinMaxInfo handler and modify the MINMAXINFO structure.
-
June 14th, 1999, 01:27 PM
#11
Re: Prevent Window Move
The only reason I do this is because I don't like the appearance of windows
that have WS_THICKFRAME turned off. This method allows you to set pretty
much whatever frame styles you want and have control of sizing and moving.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|