-
May 23rd, 2002, 09:45 AM
#1
An ASSERT occurs while I'm trying to get the coordinates of the toolbar in WM_SIZE!
I hate to say this, but I tried to get the coordinates of the toolbar in the WM_SIZE, after the program has been maximized.
But the program gives me an ASSERT error!
But I thought the toolbar is already created when WM_SIZE is called?
Help please!
Can anyone show me how to get the bounding coordinates of a toolbar after the program has been maximized?
I even tried WM_ACTIVATE, WM_SHOWWINDOW and WM_WINDOWPOSCHANGED, but in vain.
Thanks a lot!
"Hell is calling for you!" - Rufus, from Valkyrie Profile 2 : Silmeria
"I'm getting tired of you devils.....finishing strike......Final Blast!" - Arngrim, from Valkyrie Profile 2 : Silmeria
-
May 23rd, 2002, 10:05 AM
#2
Are you processing WM_SIZE in the CMainFrame class ?
If so, the OnSize() gets called twice at startup. The first
time it is called, I do not think the toolbar exists.
Are you checking the nType argument to make
sure the window is being maximized ?
you might want to make sure the toolbar exists ...
- Add member variable to CMainFrame class :
Code:
bool m_createdToolbar;
- initialize in the constructor :
Code:
m_createdToolbar = false;
- at end of OnCreate() ...
Code:
m_createdToolbar = true;
- OnSize() ...
Code:
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if (m_createdToolbar)
{
// do something
}
}
[
-
May 23rd, 2002, 10:07 AM
#3
-
May 23rd, 2002, 10:36 AM
#4
It's easier to check if the HWND of toolbar is not null in OnSize(), this way you don't need an extra variable. In fact WM_SIZE is often sent to a window before its children have been created.
regards,
MiMec
-
May 23rd, 2002, 09:34 PM
#5
Thanks a lot to the following folks who have contributed to my movie :
Phillip Nicoletti
Prem_Gali
MiMec
"Hell is calling for you!" - Rufus, from Valkyrie Profile 2 : Silmeria
"I'm getting tired of you devils.....finishing strike......Final Blast!" - Arngrim, from Valkyrie Profile 2 : Silmeria
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
|