CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2001
    Location
    Singapore
    Posts
    200

    Help needed for CTreeCtrl

    I have created a CTreeCtrl in my dialog box. Using the EditLabel function of CTreeCtrl, I will allow the user to edit the selected item's text.

    When the EditLabel function is called, the CTreeCtrl will begin in place editing of the selected item's text. The editing is accomplished by replacing the text of the item with a single line edit control containing the text. The user is thus able to change the text within the edit control. However when the user left mouse clicks on the edit control, the whole program will crash. Is there anyway to solve this problem?

  2. #2
    Join Date
    Jun 2001
    Location
    Switzerland
    Posts
    4,443
    Have a look at the call stack when the program crashes. Tell us where the crash happens, what the failure is (e.g. access violation) and post the relevant code please.
    Gabriel, CodeGuru moderator

    Forever trusting who we are
    And nothing else matters
    - Metallica

    Learn about the advantages of std::vector.

  3. #3
    Join Date
    Jan 2001
    Location
    Singapore
    Posts
    200
    Originally posted by Gabriel Fleseriu
    Have a look at the call stack when the program crashes. Tell us where the crash happens, what the failure is (e.g. access violation) and post the relevant code please.
    Its bascially an Assertion failure. It crashes at CWnd::AssertValid()
    at ASSERT(::IsWindow(m_hWnd));

  4. #4
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    OK. And now from that assertion failure (which occurs in the MFC sources) walk back the calling stack (using the calling stack combobox in the debugger) to find the statement in your code which initially caused this.

  5. #5
    Join Date
    Jan 2001
    Location
    Singapore
    Posts
    200
    Originally posted by gstercken
    OK. And now from that assertion failure (which occurs in the MFC sources) walk back the calling stack (using the calling stack combobox in the debugger) to find the statement in your code which initially caused this.
    Its bascially caused by KERNEL 32! 77f1ba06() and WinMainCRTStartup() line 330 + 54 bytes......

    I am not sure how this happen.

  6. #6
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    Originally posted by Lim Say Kiap
    Its bascially caused by KERNEL 32! 77f1ba06() and WinMainCRTStartup() line 330 + 54 bytes......
    Well, everything is basically caused by WinMainCRTStartup(), because this is the program's main entry point.

    That's why I asked you to look for the statement in your code which causes this. Although it would be much easier to find the problem if you posted your code, I suspect that you are trying to use a window (maybe your CTreeCtrl?) before it is created. Remember, if you dynamically create a control, it is not enough to declare an object, you first need to call Create() to actually create the window. This is not the case if your control is created from a resource template.

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