CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Xeon's Avatar
    Xeon is offline Want me to ban you?! Power Poster
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    4,195

    Talking 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

  2. #2
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,721
    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
      	}
      
      }

    [

  3. #3
    Join Date
    Oct 2000
    Location
    India
    Posts
    489
    Can u post some code ??

  4. #4
    Join Date
    May 2002
    Location
    Poland
    Posts
    48
    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

  5. #5
    Xeon's Avatar
    Xeon is offline Want me to ban you?! Power Poster
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    4,195

    Talking

    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
  •  





Click Here to Expand Forum to Full Width

Featured