Click to See Complete Forum and Search --> : How to prevent VB from crashing when during subclassing
andromedia
Oct 12th, 2000, 10:18 PM
I'm using subclassing to limit the form size in resizing. However, it crashes when I presses the stop button or when I terminate it without giving the message processing control back to VB... is there any way to prevent that?
HughLacey
Oct 13th, 2000, 03:51 AM
Don't press the stop button!
Jerry Grant
Oct 13th, 2000, 11:06 AM
Go to the Microsoft downloads site and get Dbgwproc.dll to allow stepping through subclassed code in break mode in the VB IDE.
(You need to have a registered copy of VB or VStudio)
Then check out the following site:
http://www.mvps.org/vbvision/grouped_demos.htm#Form_Modifications
kedaman
Oct 13th, 2000, 01:48 PM
Make a ActiveX control do the subclassing for you. Pass the form handle to it and when you press the stop button or in some other way break the execution, you wont crash. Before the final compilation, just remove the activeX and place the subclassing module back in your project.
Also, if you want i can send the activeX to you.
Just remember to close your App the proper way by pressing the X button.
kedaman
Oct 13th, 2000, 02:58 PM
WEll usually you don't remember to do that, or sometimes you won't be able to do that and sometimes your app just break at a point and then crash
Once you get into the habit of using the X button instead of stop, it wont be a problem. With regards to breakpoints, you can use a different means of debugging instead such as printing to the Debug Window.
kedaman
Oct 13th, 2000, 03:44 PM
No,i mean when your code break on certain errors
And another thing to keep it from crashing, DO NOT have an END statement in the code. Only an Unload statement.
kedaman
Oct 13th, 2000, 07:06 PM
Right, try to avoid End even if you don't subclass, unload all objects and forms and it will end automatically or if you start from sub main, unload all objects and exit the procedure or use end.
You can use the SSubTmr.dll from VBAccelerator to subclass with ease.
I also have a similar QST. I want to know HOW to subclass without it crashing. I may need to debug code because sometimes there's a forced routing. I DON'T want DLLs cluttering my prog, so is there a way to do that WITHOUT the debug crash?
Using the End statement is a shortcut for pressing the Stop button, hence, when you code any App, try to avoid using End.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.