VB6 Application Silently Crashes on Startup/Form Loading - vb6

I have a VB6 app that loads initially (for a small prompt to enter a license key, only on the first time). It works fine on my machine (windows 7).
I had complaints of it crashing on someone else's machine (both xp and 7), so I made a Windows XP virtual machine. I installed it on the virtual machine, it crashed. I wanted to see where it crashed so I installed Visual Studio on the virtual machine so that I would get a debug prompt. When I ran the program again, it worked.
I am more familiar with C++ and had these kinds of problems, so I figured it was some sort of runtime issue.
I found this VB6 SP6 Redistributable Runtime:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=24417
I installed that, and it still wouldn't run.
Any ideas where to go from here?
Edit:
I have tried depends.exe, it only shows MSJava, which I've heard I can ignore. Does depends.exe also show things like .ocx (Active X controllers?) that are required?
Also, from the cmd prompt, %errorlevel% doesn't seem to get populated. Is that a VB6 things, or does that indicate that this is truely a crash and not a user exit?

Open the Visual Basic project and check both "References" and "Components" under the "Project" menu.
Since it is crashing with the VB runtime installed it is likely a component that you have referenced in the project that either does not exist (or is not registered) on the client under test.
This should be a simple fix.

I had the same problem on my windows 7 computer.
I have uninstalled everything, changed my windows theme to Windows Classic.
I changed following properties of VB setup file.
Right click on setup.exe and go to properties and in compatibility tab change the compatibility mode to windows XP SP2. And in settings uncheck the following check boxes.
Disable Visual themes
Disable Desktop composition
Disable display scaling on high DPI settings.
Run this program as an administrator
And have completed installation.
Followed by installing VB 6 service pack 6 from here.
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=24417
Hope it helps.

It may require something else other than just the runtime, have you tried viewing it with dependency walker http://www.dependencywalker.com/ on the machine that it crashes on?
It should quickly point out any missing references.

Maybe try again, create a new VM, but install the remote debugger instead of the full VS.

You should create an installer for your application. There may be more dependencies than just the VB6 runtime. A good installation tool will detect at least some of necessary dependencies for you. Have a look at this question or this question

Related

VS Express 2012, Windows Phone 8 SDK: The interface is unknown

I can't deploy applications to to my Windows Phone 8 device from Visual Studio Express 2012 anymore. I always get the following two lines in the console:
Deployment of application to device failed.
The interface is unknown.
The emulator also does not work anymore (xde.exe just crashes). All that worked once (Hyper-V is active).
All that happened without a change to my app (the same happens with a fresh hello world app).
The problem is not my phone, I tested a different phone (even different model), same problem.
I already completely removed and reinstalled the Phone SDK including Visual Studio.
The problem might have occurred since I updated to Windows 8.1 but I am not sure about this.
If anybody has a clue of what is going on here I would highly appreciate your help.
Since you've already tried removing/reinstalling VS and SDK, try creating a new user account on your Win8.1 box and running VS from that. If it works, the problem was probably some settings in CurrentUser registry hive, which Remove doesn't always clean up. Reinstall the already-installed VS and SDK may work better.
The 'interface' error means this is likely some COM issue, and that implicates registry. If you can figure out which DLL contains the interface, you may be able to fix it with (admin command line) > REGSVR32 <dllPath>. You can trace the registry accesses being made when you try to debug the app via SystemInternals ProcessMonitor

debbuging a plug-in DLL

I am working on a plug-in for an application. I have old development tools that have problems. My development tools are all from old 32 bit versions. CodeWarrior 6.7.and 8. I am running windows 7 pro 64 bit and having problems with the old tools. The CodeWarrior debugger will only work one time and I have to reboot before it will work again. It also has some problem using it. Break points stop working.
I switched to UeStudio from IDM but can not get a debugger to work. I created a project to use the compilers from Microsoft Visual Studio 10.0. UeStudio is supposed to use an integrated debugger. It downloads WinDbg.exe but it wont start up. The only WinDbg I found on Microsoft is from the Debugging Tools for Windows (x86) and (x64). It does not integrate with UeStudio. It starts up in a separate window. I have played around with it a bit but can not get it to load my DLL. I keep getting and error that it can not load my symbols (mismatching symbol file). I have set it to look were the '.pdb' for my plugin is located an doubled checked that it is correct. It's message names my DLL. I do not have symbols for the application. They do not supply one. I can load my source file and set Break points. But can not examine data.
Anybody get UeStudio debugging to work on windows 7? Or have any idea on debugging DLL on windows 7 cheaply.
I use OllyDebug.
OllyDbg
IDA is also very nice (paid)

Building C# for Windows 7 32 bit platform on Windows 7 64 bit machine

Whats the correct way to build the setup installers for a Windows Forms app to install and run on a Windows 7 32 bit machine, using Visual Studio 2010 on a Windows 7 64 bit machine ?
I've just brushed the dust off a 3yr old Visual Studio 2008 app, built on Windows XP, using SQL Express 2005.
I've updated it to VS2010, SQL Express 2008, and rebuilt it on a Windows 7 64 bit machine. It needs to run on a Windows 7 32 bit platform.
The setup project for database keeps failing (on startup) when run, saying its only for an x64 machine. (The setup for the app runs ok and installs.)
I've been through every project in the solution and set it to build using x86 (as opposed to Any CPU). I've removed all PreRequisites. The only thing suspect left in there is a DB CustomAction project (which runs the db scripts).
From googling it seems to me building on a 64 bit machine with 'Any CPU', means it should produce setup files that will run on a 32 bit machine via WOW ? and without having to make all the changes Ive been making ? Am I missing something bleedingly obvious ?
Thanks.
Try this:
select your setup project in Solution Explorer
go to its Properties pane
make sure that TargetPlatform is set to x86
I always find it frustrating coming across posts of the same question I have that never had a resolution posted. So I'll post what I found in case it, or even some if it, is of use to others one day. I found a lot of other developers reporting the aimless Windows 7 program 'has stopped working' message.
By the way, I found the easiest way to test deploying the app and the installers was to build a Virtual PC machine with the same configuration as the platform will eventually run on. Then copy that Virtual PC, and test run on the copy. That way, I can just delete the copy at any time, recopy from the original and start over, quickly.
Yes, as Cosmin said, the TargetPlatform Property of the solution also needs setting to x86. Anyway, didnt fix the the problem, the app still produced the 'has stopped working' message.
Next I checked the SQL logs ERRORLOG file (c:\Program Files\Microsoft SQL Server\MSSQL10.SQLExpress\MSSQL\Log) and it was reporting the app was trying to logon using Mixed Mode authentication, whereas SQL was set for Windows Authenication. Now I KNOW I selected Mixed mode when I installed SQL Express, as my app uses a sql service account which my db installer creates the account for. So somehow that was changed by something (dont know what?). To set to Mixed mode via SQL Server Management Studio you just right click on the instance, select Security, and change Server Authentication. Without Management Studio, you need to edit the registry HKEY_LOCAL_MACHINE/Software/Microsoft/Microsoft SQL Server//MSSQLServer, and edit key LoginMode = 2 for Mixed. Once again, didnt fix the problem, the app still produced the 'has stopped working' message.
Next, by chance I stumbled across some posts about this message can be caused during startup by loading 32 bit apps on Windows 7. I put MessageBoxes, and Try/Catchs on the first lines I could, and they never got displayed, and no error was caught.
The next thing I tried was to run DependencyWalker over my exe. It reported 2 x 32 bit files missing: IEShims.dll and GPSVC.dll. There are posts from other devs encountering this, and the end result was I found them in C:\Windows\winsxs (GPSVC.dll was called x86_microsoft-windows-g..licy-base.resources_31bf3856ad364e35_6.1.7600.16385_en-us_c10af1bed239c523_gpsvc.dll.mui_0c160ac2). I dropped them into C:\Windows\System32, recompiled my app, deployed it to my test machine, and it finally ran !
Still dont understand why just putting them into the System32 dir on my dev box made the app run on the test machine ? But anyway, it fixed the problem, and hope this is of help to others.

vb 6.0 program on windows 7

I have been trying to install and run a program written in vb 6.0 on windows 7. It was working fine installing and running in windows xp. The error message after installing and running it say that
Run-time error 339" : Component voice.ocx or one of its dependencies not correctly registered: a file is missing or invalid.
This program has voice recording things.
I manually register that ocx component but still error that shown like
The module "voice.ocx" failed to load.
And I try to install VB run-time and still shows the same error. I believe that Windows 7 support vb 6.0 programs.
One thing here I am not sure of is that the ocx component I have is whether 16 or 32 bit version. I don't think we cannot register 16 bit version ocx in windows 7.
And I also try to install and run in compatibility mode or even as administrator. I think it is a platform related issue? And it might be some other work-around. So, I appreciate your hints or clues on this program runnable in windows 7.
Thanks in advance.
Regards,
SEE
Just encase anyone else sees this.. here is what I did
I knew the program was running on Windows XP, with visual basic installed. I had only been given the exe and the MDB. So I created a virtual machine (stick with me) of Windows XP, installed visual basic and test the app. It was fine. Then I downloaded a dependency tool called Dependency Walker from http://www.dependencywalker.com/. I installed this in the virtual machine and asked it to open my exe.
Once this was loaded I ignored the warnings and asked it to start profiling. I ran the app, stepped through everything I could see, then exited the application. This left me with a log of the DLLs that had been accessed. Slowly I went through these checking if they existed on my windows 7 setup, when one was missing I copied it to my application directory and then from an elevated command prompt run "regsrv32 [missing_name.dll]" until there were no files which my windows 7 desktop didn't have.
the application then worked fine! This may not work all the time, because of the way third party OCX's or DLLs have been written. But it may help someone out.
Few of old Win32 components are not supported in Windows 7. There are possibilities of failure of a VB Program in Windows 7.
But there are some possible ways to fix those.
Check the following links to avail the same.
http://www.personalcomputerfixes.com/general-errors/how-to-successfully-fix-the-339-runtime-error/
http://social.msdn.microsoft.com/Forums/en-US/vbpowerpacks/thread/8cb5ab97-8407-4e49-8db6-30dcef87cbd1/
http://yang.articlesbase.com/operating-systems-articles/simple-solutions-on-how-to-fix-runtime-error-339-1830111.html
I have developed several programs with VB5 on a WinXP32 machines and then installed them on Windows 7 (32 and 64) PCs without problems.
This applications use different OCXs (16 and 32 bit version) and till now I never get problem with them. Thus I do not think that the VB5 or Vb6 could have any issue on Windows 7 machines.
On the other hand I would point out the module "voice.ocx" and investigate if it can run on a windows 7 pc, because as Katturaja sais some old ocx have problem on win7. To do that, I would create a simply VB6 project that uses voice.ocx (just an Hallo-World"), then create the installation pack and finally try to install on a clean win7 machine (for example a virtual machine). In this way you could isolate the problem.
I hope this could help you.

Has anyone had success with Visual Studio 6 on Windows 7?

VS6 popped off a series of errors before bombing out completely during install on Windows 7. I specifically need to get VB6 functioning on Windows 7. Anyone having any luck?
Folks on the VB6 newsgroup report they have managed to get it working on Windows 7.
There's this step-by-step guide on how to install the IDE on Windows 7 (including 64 bit).
If that doesn't work (scrapes barrel) try this old tip about persuading the install not to install the Java VM? Link is now broken so here is the tip:
Before trying to install VB6. Create a new file, name it msjava.dll and place it in your windows directory. The file can be zero length. You can then happily install without the prompt to install an old version of Microsoft's flavour of Java. Once you have installed VB6, delete the msjava.dll otherwise windows update will prompt you to update it.
Or (scrapes hole in barrel) these tips from an article about getting the IDE working on Vista?
Footnote: if developing with ADO, be aware of this.
The only way I've found that works is Windows XP mode (i.e. a virtual machine). Works fine there, but otherwise, not at all.
I found ALL the answers in a thread at vbmonster.com. As mentioned above, you CAN install Visual Studio 6 with Service Pack 6 under Windows 7 by following Derek's detailed instructions at fortypoundhead.com.
I had a problem because I needed to install Service Pack 5. I use a third party program that does not work with Service Pack 6. A really smart programmer (GuideX) came up with a great hack to get around the MDAC 2.5 error.
Win 7 64 bit service pack 5 & 6. Turn compatability off and it seems to work.
Recently I had to debug an ancient application written in Visual C++ 6.0 on Windows 8.1. Tried different solutions all of them failed, only this one worked.
This guys made a special installer that allows installing VC++6, VB6, and SP6 on Windows Vista/7/8/8.1/10 without any errors whatsoever.
Hope it would be helpful to someone.
I installed VB6 on Windows 7 Pro without having to use compatibility settings or run as administrator.
Doesn't really help you, but does show that it can work.
Several people in my office have installed Visual Studio 6 (without VC++) on Windows 7, both 32-bit and 64-bit with no problems. The one thing we have in common: we've all turned UAC down to it's lowest setting. Nothing else special required.
I am using vb6 on windows 7 32 bit system for a long time.
you will need to install your vb6 with compatibility of xp2.
Create a 0-byte file in the C:\Windows directory called msjava.dll.
Don't just install via the Autorun executable; instead browse the Visual Studio 6 CD (or folder), right-click Setup.exe and select Run As Administrator.
On any Program Compatibility Assistant warnings, click Run Program.
Step through the setup screens until you're able to choose Custom Setup, then click next.
On the setup options, install the following items and nothing else:
Microsoft Visual Basic 6.0
ActiveX
Data Access
Graphics
Click continue and the process will start, and (hopefully) eventually complete.
Skip the installations of the MSDN CD, BackOffice, VSS and SNA Server, and clear the checkbox for "Register Now". Setup should be complete.
Download the VB6 Service Pack 6 from http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=A8494EDB-2E89-4676-A16A-5C5477CB9713&displaylang=en and install.
Change the compatibility settings for Visual Basic (to get it to run a little more smoothly under Windows 7) by browsing to C:\Program Files\Microsoft Visual Studio\VB98, right-clicking the VB6.exe file, and selecting properties.
On the Compatibility tab, check the following:
Run this program in compatibility mode for Windows XP (Service Pack 3)
Disable Visual Themes
Disable Desktop Composition
Disable display scaling on high DPI settings
When you start up the IDE, you may get a notification saying that the color scheme has been changed to Windows 7 Basic, but it will be changed back to Aero once you exit. Everything should be working fine at this point!
Note: when you first run your new install vb6 run it with admin rights and with xp2 compatibility so that your exe can run on any system.
The word "supported" is used loosely in this thread, potentially leading the unwary reader to the conclusion that Microsoft supports the VB6 IDE (that is, the integrated development environment) on operating systems beyond Windows XP. This fact clearly is stated in the table that appears on the page at this link:
https://blogs.msdn.microsoft.com/nikosan/2012/04/20/support-statement-for-visual-basic-6-0-on-windows-8-updated/
Note that executables developed using VB6 are in fact compatible with Windows OS's from Windows XP through Windows 10--32/64-bit versions:
https://blogs.windows.com/buildingapps/2015/06/22/getting-ready-for-windows-10-sdks-compatibility-bridges/
Anyone using non-standard methods to coax the IDE into working on OS's that Microsoft does not support is exposing themselves/their organizations/their employers to risk and is not suitable for risk-averse organizations.
Having said that, I think the purest solution is to install Windows XP onto a virtual machine and run that VM in a modern host OS, such as Windows 10. That works just fine, and you can install directly from the VB6 Setup disc without making any pre-install/post-install customizations.
I had a Vista x64 box with a working copy of the VB6 IDE (which was supported). I upgraded the OS to Windows 7 x64 and the VB6 IDE still works fine. You could try that. I know, a huge PITA and kludgy but still, it worked for me.
I run Windows 7 Ultimate 32-bit, installed Windows Virtual PC - XP Mode, and that solved my problem isince I can run MSDEV 6.0 in the XP Window.
Not esay to install XP Mode though, the MS site is buggy.
The VB6 programming language is supported on the Windows 10 Technical Preview.
Visual Vasic 6 applications run and the VB6 IDE installs and works too.
I have the VB6 IDE running OK on Win-XP-16, Win-7-32, Win-7-64, Win-8.1-32, Win-8.1-64, win-10-32 and win-10-64 by using the instructions above which basically say, turn off UAC, run the installer AS ADMIN, and then set the VB6.exe file to run in XP-SP3 Compatibility mode.
I have had some issues with it and have had to do a bit more googling to solve these but I don't remember any more what those issues or solutions were.
I've even got the VB3 IDE running on the 32-bit versions of XP, Win-7, Win 8.1 and Win-10 - without even installing them - just copied the C:\VB folder from another computer and copied the *.LIC license files and *.VBX etc files as well.
I have successfully installed vb6 on win 7 32 bit by installing xp first then installing new win 7, (not upgrade), and do not format. then it will install vb6 without a problem
It's depending on your build version of Windows 7.
If your Win7's version is lower or is not updated, it has MANY PROBLEMS with compatibility.
But mine is newer Win7 version and has NO COMPATIBILITY TROUBLE.
I am currently using VB6 , VS6 and they still work fine!
If Properties->Compatibility->Windows XP doesn't help, fix it with UPDATING your Win7.

Resources