WM_SIZING problems
Glen Hein -- ghein@nye.nscee.edu
Thursday, November 21, 1996
Environment: Win95, VC++4.2-flat
I'm trying to use WM_SIZING and I'm having about no luck at all.
Basically, I have an application where I want to control the specific
sizes a window can be. According to previous hellp that I have
received and documentation that I have read, the best way is to use
WM_SIZING.
Here are the appropriate pieces of code that I tried:
(I tried this with the main frame, the child frame, and the view)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
ON_WM_SIZING()
// Global help commands
ON_COMMAND(ID_HELP_FINDER, CMDIFrameWnd::OnHelpFinder)
ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp)
ON_COMMAND(ID_CONTEXT_HELP, CMDIFrameWnd::OnContextHelp)
ON_COMMAND(ID_DEFAULT_HELP, CMDIFrameWnd::OnHelpFinder)
END_MESSAGE_MAP()
...
void CMainFrame::OnSizing(UINT nSize, LPRECT lpRect)
{
TRACE("CMainFrame::OnSizing()\n");
CMDIFrameWnd::OnSizing(nSize, lpRect);
}
...
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
afx_msg void OnSizing(UINT nSize, LPRECT lpRect);
DECLARE_MESSAGE_MAP()
This approach does not work. I have never been able top get one of my
OnSizing() functions to get called.
Using Spy++, I found the Class that is associated with the WM_SIZING
message. If it helps, here it is:
Afx:400000:b:150e:6:32df
Also, The ClassWizard does not list WM_SIZING as a message. Does
anybody know what's up with this?
Thanks in advance,
Glen Hein
ghein@nye.nscee.edu
Mike Blaszczak -- mikeblas@nwlink.com
Sunday, November 24, 1996
At 14:06 11/21/96 -0800, Glen Hein wrote:
>Environment: Win95, VC++4.2-flat
You should install the 4.2B patch. The patch fixes lots and lots
of bugs. Eventually, you'll end up wasting your time because you've
not installed the patch; MFC 4.2-flat is incompatible with released
versions of Windows 95 and Windows NT system components.
>I'm trying to use WM_SIZING and I'm having about no luck at all.
All of your code looks okay. I can get similar code that I've
written to be called when I size the main window, but I'm using
4.2B. Maybe this iwas a bug that was fixed, or maybe there's
something subtle that's wrong with your code that I can't see
(or that I'm looking at but not realizing).
>Also, The ClassWizard does not list WM_SIZING as a message. Does
>anybody know what's up with this?
Since WM_SIZING was, for a time, Windows 95-specific, it was not put
into ClassWizard. Visual C++ 4.2 was released at that time, you know--so
it only makes sense that it isn't there. Some future version of the
product will have it in there, I'm sure.
.B ekiM
http://www.nwlink.com/~mikeblas/
I'm afraid I've become some sort of speed freak.
These words are my own. I do not speak on behalf of Microsoft.
Dong Chen -- d_chen@ix.netcom.com
Sunday, November 24, 1996
I don't know if this will help you since I didn't read your previous
posting. But if you are tracing the sizing of a window. The message pair of:
WM_ENTERSIZEMOVE
WM_EXITSIZEMOVE
can be used.
Add these lines in the message map:
ON_MESSAGE(WM_ENTERSIZEMOVE, OnEnterSizeMove)
ON_MESSAGE(WM_EXITSIZEMOVE, OnExitSizeMove)
And declare the functions as:
afx_msg LRESULT OnEnterSizeMove(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnExitSizeMove(WPARAM wParam, LPARAM lParam);
--
Dong
d_chen@ix.netcom.com
| Вернуться в корень Архива
|