Invalid page fault with Kernel32.dll during exit

I am having this Invalid Page Fault with Kernel32.dll every time I click on the Exit button. This does not happen to every single pc. Only a few of them will encounter this error.
when I click on the Exit button, it will call Form_UnLoad() where inside the form_unload, I will use the
End to terminate the application. Am I doing something wrong here that causes the invalid page fault?


wsmAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lortegaCommented:
there are so many issues (not bug... :->) in the VB memory clean ,and so many issues with Windows system libraries (Kernel.exe,User.dll,oleaut.dll,etc...) versions

First: if you use OLE or DAO be carefull in the use of SET (exm. Set myDatabase = DBEngine.Opendatabase...) if you do something like this be sure to clean memory (Set myDatabase = Nothing) is you don't doit VB can have problem when try to clean...

Second: is good if you finish your program whit the same form that you started, if the form that you are unloaded is the first you don't need to call end...

Third: is a good idea to try to call End in Form_QueryUnload message
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MikeP090797Commented:
The failure may also happen if you are using hooks in your program and don't terminate them properly, multiple threads, or a message interception procedure that you don't terminate
0
MikeP090797Commented:
Is there any code in other's forms Unload events, especialy dll calls
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

MAVERICKCommented:
are the PC's that don't work using WinNT? it is possible that this is why it only doesn't work on some PC's

0
wsmAuthor Commented:
all the other forms Unload do not call any dll.  I had made a simple test to my
application that the minute I launch my application, I do not do anything at all, and then click on the Exit button,

Inside the Exit button command, I will call Unload me where
this unload me will actually call form unload event. Inside this form unload event
I had put in some message box for debugging purposes. Well, all those message
box came out ok, except that at the very last message box, (just before the end statement), when I click on the ok at the message box, the invalid page fault will
prompt up. Then I had put in all the unload statement just before the end statement to unload off all my other forms eg.

form_unload()
  msgbox "about to call end"
  unload form1
  unload form2
  end
end sub

The invalid page fault will still be prompted. btw, I am using VB4.0 (32-bit)
any other ideas?

0
MikeP090797Commented:
I've expiriensed simular problem when I subclassed the window. Try calling the ExitProccess API instead of End. It will close VB as well, but at least you won't get a gpf
0
wsmAuthor Commented:
I am not very fimiliar with API calling. Can you please give me an example of
how to call this ExitProcess API. Thank You
0
MikeP090797Commented:
Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)

'Use it:
ExitProccess 0
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.