Solved

Invalid page fault with Kernel32.dll during exit

Posted on 1998-04-10
8
280 Views
Last Modified: 2009-12-16
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
Comment
Question by:wsm
8 Comments
 
LVL 2

Accepted Solution

by:
lortega earned 100 total points
Comment Utility
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
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
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
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
Is there any code in other's forms Unload events, especialy dll calls
0
 
LVL 1

Expert Comment

by:MAVERICK
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:wsm
Comment Utility
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
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
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
 

Author Comment

by:wsm
Comment Utility
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
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)

'Use it:
ExitProccess 0
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to delete range 4 54
VBA loop through headers using value 3 48
VBA open file from excel cell 4 33
How to debug this code 7 48
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now