Win7 problem with VB6 ocx registration - windows-7

Have a lot of older VB6 apps running at work and starting to bring in Win7 machine.
I run one and find an error of OCX registration along the lines of ...ocx is not registered.
RegSvr32 \\Uhsfp1\UserPrograms\sharedcomponents\UHSLineItems.ocx
and no errors when run as an admin from cmd prompt.
I run the app again and I read an error:
An error was encountered granting
access to certain features in this
application. ActiveX component can't
create object.
Really don't want users to see that.
Any ideas?
TIA

Is it a 64-bit machine? Try registering with C:\Windows\SYSWOW64\regsvr32.exe instead of the default which would be C:\Windows\System32\regsvr32.exe. The former is the 32-bit version which should make your components available to other 32-bit programs.

Try unregistering the OCX and then registering it again.

You need to make sure that the command prompt (or calling process) is running elevated in order for regsvr32 to succeed on Windows 7

Related

VB6 app 'Run as administrator' issue

I have a vb6 application that runs fine when double clicking the .exe. When I right click the .exe and select 'run as administrator' (on a Windows 7 machine), I get an error: "Run-time error 429. ActiveX component cant create object"
What dll/com is missing?
This seems pretty clear.
One or more DLLs and OCXs you are using was not properly installed and registered. Most likely some of them have been virtualized, either in the filesystem and/or the registry. They can only be seen by that one user when running under its standard-user context because the admin context doesn't have virtualization applied. Log on as a second user and you'll see the same failure.
Installation needs to run under TrustedInstaller, or at least elevated. That's the only way libraries can be placed and registered globally as they need to be.
Have the same problem and in my case I solved in this way:
reference global system DLLs only from C:\Windows\SysWOW64 (ex. msxml6.dll)
run VB6 IDE as Administrator and compile your program

DllRegisterServer failed for comct332.ocx

I have a VB6 application I am trying to get working on a Windows 7 environment, however every time I start the application, I get the error:
"Component 'ComCt332.ocx' or one of its dependencies not correctly registered: a file is missing or invalid".
To resolve, I have tried to register the comct332.ocx file by running the regsvr32 in the Command Prompt in Administrator Mode but then I get the error:
"The module "comct332.ocx" was loaded but the call to DllRegisterServer failed with error code 0x80004005"
Other things I have tried include:
Deleting all parent nodes in the registry where 'comct332.ocx' exists
and running regsvr32 again in Admin Mode. Same result.
I granted admin permission to another user on the PC and I could register the
file successfully, and the application starts and runs successfully!
However when I log in as the previous user again, it fails miserably.
Any help, thoughts, other-things-to-try will be much appreicated. Thanks
If you have been keeping up on things as you must if you are to continue using VB6 successfully there are a number of things you'll be aware of.
One of these is the impact of UAC and per-user registry
virtualization.
Another is the impact of SysWOW registry redirection on 64-bit
systems.
You will understand that proper installation packages are more important than ever before. Windows has many auto-remediations for legacy software but some of them will not result in applications having all of the originally intended behaviors. Most of them will only be applied when your application "follows the right path" from installation to second run.
Here we have a case that is intended to be handled through use of a proper Windows Installer package, or at least a legacy setup recognized as such through Windows' "legacy installer detection heuristics." In general legacy scripted setups are deprecated but as long as they stay on the path Windows makes efforts to ensure they succeed.
Manually deploying by just copying over a bunch of files and randomly running regsvr32 on some of them has a reduced chance of success. This was never an approved method of deployment anyway.
You have most likely run afoul of some combination of registry virtualization and redirection.
The regsvr32 utility is a development tool, not a deployment tool. If you insist on trying to use it for deployment you must follow the same rules a developer must follow:
Run the correct version. On a 64-bit system there are both 64- and
32-bit versions of this utility. The 32-bit version which you must
use is located in the SysWOW64 folder.
Run it from an elevated command prompt. An easy
way to start one is to type <Winkey>cmd.exe<Ctrl-Shift-Enter> then
approve the UAC prompt or provide over-the-shoulder admin credentials
as needed.
There are many other things you need to know and handle in order to be successful. If you have ignored those most of them will only become apparent to you after your program gets installed and will run. A lot of them stem from filesystem virtualization.

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.

UAC giving problems with my application

i was making an installer for my app its working fine on xp but on vista the UAC is giving problem unless i do a run as administrator the Unexpected error appears when i run my app afters installation, any idea?
i am installing the application in C:\xfolder\x
There is nothing you can do. You MUST run the installer as administrator.
As for the application, you will also need to run it as administrator with elevated priviledges but thre are options to make it ask automatically for elevation via application manifest. You can do a search on stackoverflow.com because there are more post related to this issue.
Here is a link to a post that might help.
Here are a couple more usefull link on app manifest and UAC:
App Manifest (1)
App Manifest (2)
UAC technology.
They are in C# but then again translating to VB.net is like a walk in the park.
You can make a windows service. And put all operations that require elevated rights into that service. You install the service as SYSTEM account and you communicate with the client via .net remoting or any other way for vb6.
if your app exe is an active x exe then you will need to register all the ocx file using regsvr command and then register your exe with regsvr32 command, for an active class to be used in win vista it first must be registered. make a batch to do these registration.

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