CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 1999
    Location
    Toronto, Ontario, Canada
    Posts
    5

    Two Control Variables Crash the app

    I am creating a class for drawing Flat comboboxes and flat edit controls and it uses a generic CWnd class as a base class for compatibility with all the controls.
    Lets say that class is called "CMyClass". I create 1 variable for a combobox control named "m_Combo" of class "CComboBox". Then I create another 2nd variable named "m_FlatCombo" of class "CMyClass" for the same control. CMyClass draws the combo flat and I need m_Combo to have control over the combobox (add data, etc.).
    But when I try to compile the project everything goes well until I run the executable. If compiled in Debug mode I get wincore.cpp errors. If compiled in Release mode, I get illegal operation window. Is there a way not to crash the app?
    Maybe I was thinking of leaving variable only 1 variable and creating CComboBox class on the fly (runtime)
    I tried putting this in OnInitDialog routine:

    CComboBox cbo;
    cbo=m_FlatCombo;
    cbo.AddString("My New Item");
    ...
    ...



    How do I set the cbo object to take control over m_FlatCombo variable? PLEASE HELP ME!


    ----------------
    Genghis86
    [email protected]
    http://genghis86.cjb.net/
    ICQ: 10669758

  2. #2
    Join Date
    Apr 1999
    Location
    Germany
    Posts
    37

    Re: Two Control Variables Crash the app

    I've never used it but what about subclassing the combobox and overwrite your own parts, like drawing?

    As said I never worked with, so don't ask for any further explanations on this topic ;-)

    Good luck,
    Ron


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