stopping sdi being moved
Philip Beck -- splinta@cix.compulink.co.uk
Thursday, December 19, 1996
Environment: MSVC++ 1.52, Win 3.11
Hi,
I have an mfc sdi app which must either be maximized to full screen size
or minimized, nothing inbetween. So I make the app appear screen size
initially and I have removed the maximize button.
The problem is that when there is no maximize button, and the app is
programmatically maximized, the user can grab the caption bar and drag
the frame around. If the max button is put back the app can't be dragged,
which is what I want but without the max button.
How can this moving be prevented in a mfc sdi app ? OnMove is no good
because the user will see the outline move then snap back into the
original place.
I have removed the system menu as well. The min button is the only one
left on the caption bar, so NCHITTEST will be fiddly, and I'm not sure
what mfc messages there are to handle that...
Any suggestions would be fab...
Phil.
Michael Patterson -- patterso@sprynet.com
Friday, December 20, 1996
[Mini-digest: 3 responses]
I think this will remove the 'Size' & 'Move'. In initialization,
just set the size of your frame window to the size of the desktop area.
// delete control-menu box items (8 to 0)
HMENU hSystemMenu = ::GetSystemMenu(m_hWnd, 0);
//
for (int iT = 2; iT > 0; iT--) // delete items 2 & 1
::RemoveMenu(hSystemMenu, iT, MF_BYPOSITION);
At 02:01 PM 12/19/96 GMT0, you wrote:
>Environment: MSVC++ 1.52, Win 3.11
>
>Hi,
>
>I have an mfc sdi app which must either be maximized to full screen size
>or minimized, nothing inbetween. So I make the app appear screen size
>initially and I have removed the maximize button.
>
>The problem is that when there is no maximize button, and the app is
>programmatically maximized, the user can grab the caption bar and drag
>the frame around. If the max button is put back the app can't be dragged,
>which is what I want but without the max button.
>
>How can this moving be prevented in a mfc sdi app ? OnMove is no good
>because the user will see the outline move then snap back into the
>original place.
>
>I have removed the system menu as well. The min button is the only one
>left on the caption bar, so NCHITTEST will be fiddly, and I'm not sure
>what mfc messages there are to handle that...
>
>Any suggestions would be fab...
>
>Phil.
>
Michael Patterson
patterso@sprynet.com
Phoenix, Arizona, USA
-----From: joew@statsoft.com (Joe Willcoxson)
>Environment: MSVC++ 1.52, Win 3.11
>
>Hi,
>
>I have an mfc sdi app which must either be maximized to full screen size
>or minimized, nothing inbetween. So I make the app appear screen size
>initially and I have removed the maximize button.
>
>The problem is that when there is no maximize button, and the app is
>programmatically maximized, the user can grab the caption bar and drag
>the frame around. If the max button is put back the app can't be dragged,
>which is what I want but without the max button.
>
>How can this moving be prevented in a mfc sdi app ? OnMove is no good
>because the user will see the outline move then snap back into the
>original place.
>
>I have removed the system menu as well. The min button is the only one
>left on the caption bar, so NCHITTEST will be fiddly, and I'm not sure
>what mfc messages there are to handle that...
Well, this isn't an MFC question is it? Look up the API documentation for
WM_GETMINMAXINFO.
--
Gloria in excelsius Deo
Joe Willcoxson (joew@statsoft.com), Senior Software Engineer
Visit us: http://www.statsoft.com, Visit me: http://users.aol.com/chinajoe
#define STD_DISCLAIMER "I speak only for myself"
__cplusplus spoken here;
-----From: Roma
Philip Beck wrote:
>
> Environment: MSVC++ 1.52, Win 3.11
> ...
> How can this moving be prevented in a mfc sdi app ? OnMove is no good
> because the user will see the outline move then snap back into the
> original place.
> ...
> Any suggestions would be fab...
>
> Phil.
Override OnNcHitTest like this:
UINT CSomeWnd::OnNcHitTest( CPoint point )
{
UINT hitCode = CBaseClass::OnNcHitTest(point);
if(hitCode==HTCAPTION) return HTNOWHERE;
return hitCode;
}
This way you'll fool window default procedure as if nothing happend
over the caption.
-Roma
Sven Plastwich -- sven.plastwich@flensburg.netsurf.de
Friday, December 20, 1996
Hi,
try this one:
UINT CMainFrame::OnNcHitTest(CPoint point)
{
UINT res;
res = CFrameWnd::OnNcHitTest(point);
if (res == HTCAPTION) // In the caption ?
return HTCLIENT; // tell him he is in the CLIENT-Area
else // otherwise
return res; // do what you like
}
It works under MSVC 4.0-4.2 on NT3.51, 4.0, W95
If you are facing problems don't hesitate to mail me for a sample!.
Best regardz and merry xmas
Sven
----------
From: Philip Beck[SMTP:splinta@cix.compulink.co.uk]
Sent: Donnerstag, 19. Dezember 1996 15:01
To: mfc-l@netcom.com
Cc: splinta@cix.compulink.co.uk
Subject: stopping sdi being moved
Environment: MSVC++ 1.52, Win 3.11
Hi,
I have an mfc sdi app which must either be maximized to full screen size
or minimized, nothing inbetween. So I make the app appear screen size
initially and I have removed the maximize button.
The problem is that when there is no maximize button, and the app is
programmatically maximized, the user can grab the caption bar and drag
the frame around. If the max button is put back the app can't be dragged,
which is what I want but without the max button.
How can this moving be prevented in a mfc sdi app ? OnMove is no good
because the user will see the outline move then snap back into the
original place.
I have removed the system menu as well. The min button is the only one
left on the caption bar, so NCHITTEST will be fiddly, and I'm not sure
what mfc messages there are to handle that...
Any suggestions would be fab...
Phil.
Mihir Dalal -- m_dalal@ECE.concordia.CA
Tuesday, December 24, 1996
Thanks Michael, you are right. I am on the MSVC 1.52 platform and tried
out your code for my SDI application.
It works fine !!!
Phil, are you listening ???
Mihir.
(University Researcher)
On Fri, 20 Dec 1996, Michael Patterson wrote:
> I think this will remove the 'Size' & 'Move'. In initialization,
> just set the size of your frame window to the size of the desktop area.
>
> // delete control-menu box items (8 to 0)
> HMENU hSystemMenu = ::GetSystemMenu(m_hWnd, 0);
> //
> for (int iT = 2; iT > 0; iT--) // delete items 2 & 1
> ::RemoveMenu(hSystemMenu, iT, MF_BYPOSITION);
>
>
>
> At 02:01 PM 12/19/96 GMT0, you wrote:
> >Environment: MSVC++ 1.52, Win 3.11
> >
> >Hi,
> >
> >I have an mfc sdi app which must either be maximized to full screen size
> >or minimized, nothing inbetween. So I make the app appear screen size
> >initially and I have removed the maximize button.
> >
> >The problem is that when there is no maximize button, and the app is
> >programmatically maximized, the user can grab the caption bar and drag
> >the frame around. If the max button is put back the app can't be dragged,
> >which is what I want but without the max button.
> >
> >How can this moving be prevented in a mfc sdi app ? OnMove is no good
> >because the user will see the outline move then snap back into the
> >original place.
> >
> >I have removed the system menu as well. The min button is the only one
> >left on the caption bar, so NCHITTEST will be fiddly, and I'm not sure
> >what mfc messages there are to handle that...
> >
> >Any suggestions would be fab...
> >
> >Phil.
> >
>
>
> Michael Patterson
> patterso@sprynet.com
> Phoenix, Arizona, USA
| Вернуться в корень Архива
|