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

    Emergent! What's happening to those controls when "Run|End" is selected at VB's debugging time?

    Hi, there
    As is known to all, VB's debugging process can be stopped immediately by clicking the "Run|End" from the VB menu or the "Stop" button on the tool bar. I am wondering what will happen to those controls on the VB form when this run-time environment is closed by force like that. I have written an ATL control with VC and there are some important codes handling the resource-releasing stuff in this control's destruction function. I have a VB program utilizing this ATL control. Everything goes on well if the program is closed normally in VB(such as "Unload Me" or "End") and that ATL control's destruction function will be called to release those resources it created. But, once I stop the debugging by force the way I mentioned above, a message box will pop up in VB saying "this program has executed an invalid operation and will be closed ..." and then the whole VB IDE will be terminated. I believe it is because my ATL control's destruction function is NOT called to do the clean-up job under this circumstance. But this kind of problem won't happen to those Microsoft OCX controls VB carries. How did they walk around it? What should I do? Thanks in advance.


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Emergent! What's happening to those controls when "Run|End" is selected at VB's debugging time?

    Even if I never wrote a control but in Vb, I know a little about differences between Ide (=debug mode)and non-Ide running mode: when you select stop from toolbar or menu in ide, it is like (and worse, as you found out) when you put an "end" instruction in Vb: no terminate event is called for components, no cleaning of memory and so on. I do not know how microsoft worked it around, but I use to do the following: while testing a component, I do not use the compiled object, but start it with Full Compile in ide. As soon as I have to stop the client (the program invoking components)this will not stop the component, and I can stop it manually in its Ide. All this I do from V, as my components are Vb-made. Hope you can do the same whit C components...or someone else can add knowledge.
    Best regards,
    Cesare Imperiali




    Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

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