[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

Ending a VB program

I am using VB6.0 as my developing environment.  I am unable to properly end my program on a clean 95 machine. I get the error: "dmsUser caused an invalid page fault in module MFAC42.dll"
My thoughts:
I had thought that I wasn't unloading all forms, but this did not solve the problem.  I also thought I wasn't hitting the end.  But the error seems to occur when I hit the "END"
Has anyone had a problem like this?  What did you do to fix it??  This error only occurs on Windows 95 machines, where VB is not loaded.
Thanks in advance.
1 Solution
Do you use the DataReport Designer ?
BeckyBuschAuthor Commented:
No we do not use the DataReport Designer
This may or may not solve all your problems but you should never use End to terminate your program.  Unload your forms and set them to nothing.
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

You should also explicitly destroy all object variables and close any connections to files or databases.
BeckyBuschAuthor Commented:
I do unload all forms, and set the main form = nothing.  I also close my connections to the DB.  Should I set all forms = nothing?
try doing
dim f as form
for each f in forms
   if f.hwnd <> me.hwnd then    
       unload f
       set f= nothing
   end if
next f
unload me

this will unload all other forms before yours.
dunno if it will solve ur prob though
Do you mean mfc42.dll?

Yes or no, he most likely problem is that this version of this DLL on the machine is not compatible with VB6 or some other component you are distributing.

The best solution is to create a setup package on a working machine with the package wizard and run that to install correct versions of all the required files.

A reboot will be required, since windows uses the file.

Because this file is used by the operating system, there may be problems replacing it.  If the setup doesn't work, (thefile is distributed but after running setup the old version is still in place) or you want to try to shortcut the process, you could replace this file with the version from a working machine.  Look at MS knowledge base article Q140570 on their website to find out how to replace a file in use by windows.  

I don't advise the shortcut because DLLs come in sets, and may not work if changed one at a time.  Keep a backup of the current file to go back to.
BeckyBuschAuthor Commented:
Thank you for your help.. I am building with a MFC42.dll, and the 95 machine has a 4.2 version of the MFC42.dll
Thanks again!

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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