Re: Err Object Anomaly Bug in VB6+SP5 and How to Reproduce

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



More of a guess than a genuine solution...(experts feel free to correct me
:-) )

I would guess that the form instance (Form1) crashes, but the O/S is still
calling into that memory space, and the WindowProc attempts to access the
instance Form1 which is crashed causing the second dialog with a messed up
count. The program instability is likely caused by not unhooking your
WindowProc properly on application shutdown. (Won't happen if you just let
the application crash!)

Several things you may wish to consider:
1) Use an explicit instance of Form1.
in module:
Public gfForm1 as Form1

Sub Main()
Set gfForm1=New Form1
gfForm1.Show
End Sub

Check in your WindowProc to see if gfForm1 is nothing

2) Unhook your WindowProc on program termination.
3) Handle that error properly!
I'm not sure what you mean by Err object instability. I have never
experienced any problems with the Err object.

HTH,
Sean


.



Relevant Pages