VB6 ActiveX exe - what is the proper registration

2019-04-10 12:11发布

问题:

I have recently updated a Visual Basic 6 application that is an ActiveX exe, running on Windows XP. I have a couple of testers for this application who have received a copy of the exe and are attempting to run it. However, they are getting an error message "Unexpected error;quitting" when trying to do so.

A key difference between their testing and my testing is that on the machines I tested on, I have admin rights and was able to register the application using the
appname.exe /regserver
command line.

Reading the details at MS Support about file registration appears unclear:

Visual Basic ActiveX EXE files register themselves the first time you run the EXE. However, you cannot use the EXE as a COM server until it is registered.

So does this mean that after the first time the users run the exe that the application should be correctly registered, and the error I am receiving is sign of something other than an incorrectly registered application? Or does this mean that the application will not work properly until such time as the file is explicitly registered using the
appname.exe /regserver
command line?

nb - during a production distribution, the software would be sent out to client PCs using Systems Management Server, which isn't an option for this testing.

回答1:

That particular error is indicative of the app not having been run, and the user running it for the first time not having adequate rights for the registration to occur. You can prevent this error in two ways, install as admin and run the app, or in your installer explicitly register all the type and class information associated with the ActiveX exe.