Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Invalid page fault with Kernel32.dll during exit

Posted on 1998-04-10
8
Medium Priority
?
288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 2

Accepted Solution

by:
lortega earned 300 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
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!

 
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

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!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

660 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