Click to See Complete Forum and Search --> : Emergent! What's happening to those controls when "Run|End" is selected at VB's debugging time?


FreeOperator
February 4th, 2001, 07:18 PM
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.

Cimperiali
February 5th, 2001, 07:52 AM
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.