VB6 application requiring comdlg32.ocx, running on windows server 2008 - vb6

I have a legacy vb6 application that needs to run on a server 2008 machine.
I have been unable to get comdlg32.ocx to register, which the application depends on. Any suggestions?

Hmm, does this link help you at all?
My only other suggestion is that often dependency walker is useful in these sorts of situations, in particular if you are running this vb6 application on a 64 bit OS then pay attention to whether or not comdlg32.ocx has all of its dependencies present as 32 bit libraries.

The obvious, but are you running Regsvr32 as an Admin?

If you do not want to bother about copying and registering the comdlg32.ocx file (for which you might need administrator rights anyway), check out following project, that shows how you can use the common dialog box (open and save) without using the ocx file and thus without need of registering it. It uses the comdlg32.dll directly with APIs, which is installed already on windows!
http://www.soft-hummingbird.com/Tutorial_VB_ComdlgAPI.php?lang=en
The File Backupper is a nice peace of software, that uses exactly this:
http://www.soft-hummingbird.com/File_Backupper.php?lang=en

Related

How do I create an installer exe with system ocx and dlls for a VB6 exe?

This question may seem really dumb, my apologies for having very minimal programming experience. We just need to make an inventory system exe given to us run and "work" on some computers.
The exe file itself is an inventory system made using Visual Basic 6. It runs fine on computers that have visual basic 6 installed.
However, on computers without VB6, we encounter crashes. The exe's themselves run fine but as soon as we perform something (logging in/clicking buttons/etc.), we get runtime errors 339. On one machine it says, "Component 'MSCOMCT2.OCX' or one of its dependencies not correctly registered: a file is missing or invalid. on another machine, we have a similar error but points to MSFLXGRD.OCX
I figured these problems may be caused by missing system files/dependencies and we need to first install those. How do I make an installer wizard (similar to those Windows app installers that installs system files alongside the actual app) for installing these missing dependencies?
You could do a lot worse than the free Inno Setup. I've used it for many VB6 projects and it's never failed me. There's a learning curve but it's a very flexible package.
I used to use (and contributed to) the WiX toolkit for this purpose.
This will build a standard .msi installer for you. Start with the heat program which will inspect your software and generate much of the WiX project for you, be sure to use the -svb6 option.
You will need to source the appropriate merge modules for VB6 as well, which will provide the components you are missing.

Does a Lazarus program need special permissions to run on Windows?

I built a Lazarus program and it's now in exe form.
I am able to run it on two of my computers running XP and Vista.
However, there are other computers as well running XP, Vista and Win7 but I cannot get it to run at all on them.
There are no errors, nothing... Has anyone else had this issue?
The program is connecting to a postgres DB on my LAN server.
Any idea on fixing this is really valued.
NEW INFO:
Maybe I'm wrong but here's a thought... On the development machine, I initially got an error like **libpq.dll* not found when I first tried to connect to postgres. Then after setting the path, it was fine. I'm thinking now if it cannot find that library and that's why it's not able to run.
If this is the case, should my line Application.OnException:=#CatchErr; catch the error? If not how else should I check if this dll or anything else is missing?
First, a sincere and big THANK YOU to Marco and MArtyn for the great tips and guidelines hat got me thinking of this strange issue.
Here's what happened...
I installed a fresh copy of Windows 7 and XP. As usual it did not work.
Then I suspected the old problem of libpq and then I copied libpq.dll from my working OS and put it in the application folder. By the way this machine has no Lazarus or Postgres. The moment I did this, I got my first error message saying that msvcr100.dll was missing.
And then I copied that as well. So the cycle of copy pasting went on for each and every error until I had finally brought these files to my 'non-working'.
libpq.dll - 9.2.1.12263 - PosgreSQL Access Library
msvcr100.dll - 10.0.40219.1 - Microsoft C Runtime Library
ssleay32.dll - 1.0.1.2 - OpenSSL Shared Library
libeay32.dll - 1.0.1.2 OpenSSL Shared Library
libintl.dll - 0.18.1.0 - LGPLed libintl for Windows NT/2000/XP/Vista/7
Once these files came in, the problem was gone!
Now the program works great :)
Thanks for all your inputs!
I now have to see what the above files have to say about their licenses as I have to distribute the app to other users. But I'm glad at least we figured out the problem.
No, base Lazarus programs don't require special permissions. Of course it could be that a specific functionality in the program requires special permissions (like access to ports below 1024, access to certain paths etc).
Also be aware that EXE's downloaded from what the system considers insecure sources (internet, certain kinds of shares) might be blocked by default. If that is the case, if you take the properties of the .EXE in windows explorer, there will be an "unblock" button.
Anything network related of course requires proper configuration of the firewall. The popups that query you might not always come, in case of doubt configure the firewall manually.

Vb6 component on Windows 2003 R2 won't register

I'm trying to deploy some Vb6 components on a Windows Server 2003 Standard x64 R2. I normally run these in a com+ application and I went through the normal routine of creating the COM+ application and adding all the components. Everything seemed to work fine until I actually tried to use any of the components. I would some kind of "ActiveX component can't create object" or "Application-defined or object-defined error" or something similar to that.
To remove as many variables a possible I created a very simple VB form to consume the simpliest of the components and tried that. Nope. So I created a simple install to install the component, and whooo hoooo it worked. So I tried one of the more envolved components with high hopes ... but no after the install I still can't call the component successfully. Using Dependency Walker I discovered that for some reason the msvbvm60.dll is not properly registerd.
I've downloaded VBRUN60.exe and VBRUN60SP6.exe and tried installing them. Even going so far as to do a run as with the administrator account and removing the check box for "Run this program with restricted access". I've tried to manually register the msvbvm60.dll in the SysWow64 directory.
Nothing seems to work. It just won't register. Does anybody have any suggestions? At this point I'll try just about anything.
Thanks
If you are registering the components manually you need to pay extra attention. As you are on a 64-bit OS there are two versions of regsvr32.exe. When registering VB6 components you must make sure to use the 32-bit version of regsvr32, which is located under the following location:
%WINDIR%\SysWOW64\regsvr32.exe
If you just type regsvr32 on the command prompt, normally the 64-bit version is chosen (because %WINDIR%\system32 is contained in the %PATH% environment variable), so please make sure to use the full path as above.
If you are using a 32-bit MSI to install your components, this version will be selected automatically and the registration should work just fine.
In case you haven't already done, you should give a try to Process Monitor - one of the best tools I have used on dll registering problems.
The following links will provide some usufull clues:
An excelent tutorial on using Process Monitor for problem solving;
ActiveX component can't create an object
RESOLVED! ActiveX Component Can't Create Object: Cube build failure against SQL Server 2005 Analysis Services
Hope it helps :D
I've had trouble with unregistered components for Visual Basic 6 - although not tried to use the same one as you are mentioning. Manually registering never resolved things, no matter which reg server was used
The problem (eventually) turns out to be Internet Explorer 10. Uninstalling that (due to the way Windows 7 handles IE as Windows updates, this meant unistalling newer versions first to expose the older ones) worked. Afterwards, reinstalling the latest IE brings no problem.

How to automatically run a VB6 compiled software as Administrator and in Compatibility mode

We have an ERP application which is built in VB6 and it was running just fine till a few of our customer upgraded all their systems to Win7.
This software is programmed in such a way that it registers a few plugins (found in plugin folder) which are COM based at runtime. Now when the software is run by user without setting Compatibility Mode and Run as Administrator setting it fails and crashes.
I know we can manually set both Compatibility Mode as well as Run a Administrator by right clicking on program executable and then going to its properties. But this looks very unprofessional.
I think there will be some way to tell Win 7 to automatically run a software in Compatibility Mode and Run as Administrator.
Please help me.
Compatibility is an administrative function, not a development or deployment function. It is better to fix the application where possible, especially to remove any requirement for elevation.
There are plenty of tools for investigating the issues so you can correct them. However globally registering "plug ins" at runtime is a nasty one. VB6 component self-registration is always global unless registry virtualization can redirect it. Why not create installers for the plug-ins that can run elevated once during installation?
There are ways to set compatibility less manually, even as part of installation - though Microsoft discourages this. Maybe take a look at:
Compatibility Fix Database Management Strategies and Deployment
However the effort required might be better spent on remediating the problem. Support costs will be less over time.
As the other answers have said, you shouldn't need to run all the time elevated.
If you want to register the plugins after its started (as a normal user), you can use ShellExecute() with the "runas" verb to run regsvr32.exe, or use COM elevation which has been discussed many times before.
You can indicate that an application must run as admin by specifying it in the Application Manifest, which in an xml file that you can either embed or deploy with your application.
Once your application is running with admin rights it should be able to register and load the plugins. You should not need to run in compatibility mode to access the COM plugins.

NTSVC.OCX issues on Windows 7

I have a VB6 Service that uses the standard NTSVC.ocx file to help manage all the NT service functions. The application has been running on Windows 2003 Server RC1 with no troubles. Our sales team asked if we could put this same application on a notebook that could be used as a live site demo. The only issue I am having is that the notebook is brand new, running Windows 7 and the manufacturer only has Windows 7 drivers for the devices.
There is no installer for this service. I manually load the ocx and supporting other dll's into the various Windows and System32 folder and then run regsvr32 from the command prompt to load the OCX. The service has a command line set of parameters to install and uninstall the service itself.
When I try to REGSVR32 the OCX I get the following error:
The module "C:\Windows\System32\ntsvc.ocx" failed to load. Make sure the binary is stored at the specified path or debug to check for problems with the binary or dependent .DLL files. The specified module could not be found.
One potential reason that might lead to your problem, is that the NTSVC.OCX is built with a fixed Base Address (in other words, the Image has been bound by the Linker with the /FIXED switch). Starting with Vista, the Windows Loader uses Address Space Layour Randomization (ASLR) mechanism.
Based on this ASLR feature the Windows Loader attempts to load the OCX component at another Base Address than the predefined one (the one hardcoded in the OCX image file). Since your OCX Address Base is hardcoded, the Loader will fail to load your OCX (which is technically just a DLL!).
See Snapshot below showing these fields of the NTSVC.OCX image using PeStudio:
I would first try Dependency walker. If that doesn't give you a clue as to what you need you may be SOL. Also you will have to run regsvr32 as an administrator so you should get the little UAC popup.
this ocx (an also other ocx such as vbwheelscollfix.dll) to register ist very easy.
First Step:
copy this OCX into the Folder C:\Windows\SYSWOW64 (on 32 bit, i suspect its SYSWOW32).
Second Step:
Open a CMD with administrative rights.
Last Step:
Now you can register / unregister the file from the SYSWOW path.
As ich said:
in an administrative shell:
regsvr32 C:\Windows\SYSWOW64\NTSVC.ocx did work for me. Note that \System32 did not work, as it gave me an error. It might work in a x86 environment, though.
I now have no errors in my project but did not try if it works properly.

Resources