Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

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?


0
wsm
Asked:
wsm
1 Solution
 
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
 
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now