CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2009
    Posts
    16

    Question Program Startup - WM_OnSize message

    in my OnSize message handler, I have this code:

    Code:
    	m_WebBrowser1.put_Width(cx);
    	m_WebBrowser1.put_Height(cy);
    ^ it resizes the WebBrowser control in a way that it takes up the whole dialog window.
    If user resizes a window, webbrowser changes its size as well.


    Here is the problem: when the program starts, I get 2 exactly the same errors:

    DEBUG ASSERTION FAILED
    winocc.cpp... line 373.....


    I'm able to hit ignore twice and then the program runs normally, but why do I get these errors?

    My guess is that I'm trying to use m_WebBrowser1 variable before it is declared. I could be wrong.


    How would I fix it?

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Program Startup - WM_OnSize message

    Did you notice the button that says click retry to debug?

  3. #3
    Join Date
    May 2009
    Posts
    16

    Re: Program Startup - WM_OnSize message

    yes, if I were to hit retry, the message goes away.

    but why does the message appear? where is the problem?

  4. #4
    Join Date
    Feb 2009
    Location
    India
    Posts
    444

    Re: Program Startup - WM_OnSize message

    The assertion is probably because the web browser window has not been initialized.
    I don't remember if the web browser control has a m_hWnd member, but you could try this.

    Code:
    if (::IsWindow(m_WebBrowser1.m_hWnd)
    {
        m_WebBrowser1.put_Width(cx);
        m_WebBrowser1.put_Height(cy);
    }
    «_Superman
    I love work. It gives me something to do between weekends.

    Microsoft MVP (Visual C++)

  5. #5
    Join Date
    May 2009
    Posts
    16

    Re: Program Startup - WM_OnSize message

    yup, the ::IsWindow check solved the problem

    Thanks for help

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