Solved

Invalid page fault with Kernel32.dll during exit

Posted on 1998-04-10
8
284 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
ID: 1460888
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
ID: 1460889
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
ID: 1460890
Is there any code in other's forms Unload events, especialy dll calls
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Expert Comment

by:MAVERICK
ID: 1460891
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
 

Author Comment

by:wsm
ID: 1460892
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
ID: 1460893
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
ID: 1460894
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
ID: 1460895
Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)

'Use it:
ExitProccess 0
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

829 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