Nominate our 2022 Qt Champions!

DllRegisterServer does fail for QTActiveX

  • I created a QT ActiveX control using the VS2010 QT Plugin application wizard. The projcet did compile and link but registering the server failed. After some hours I created an empty global function DllRegisterServer in the project, since in meantime I was assuming I had to create the implementation of DllRegisterServer by myself. I got the error message that there are 2 implementations now. I deleted it again. I tried to create the project again and in fact the registration worked now and the AXControl was usable! After some changes I tried again to create the project and the error came up again. Then I observed that after leaving Visual Studio an starting it again (in admin mode) the creation of the project with registration works exactly one time. A second compilation gives the following error messages:

    _Creating library A:\DATA\VisualStudioProjects\Test\QTActiveX\Win32\Debug\QTActiveX.lib and object A:\DATA\VisualStudioProjects\Test\QTActiveX\Win32\Debug\QTActiveX.exp
    1> QTActiveX.vcxproj -> A:\DATA\VisualStudioProjects\Test\QTActiveX\Win32\Debug\QTActiveX.dll
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(744,5): warning MSB3075: The command "regsvr32 /s "A:\DATA\VisualStudioProjects\Test\QTActiveX\Win32\Debug\QTActiveX.dll"" exited with code 5. Please verify that you have sufficient rights to run this command.
    1> The previous error was converted to a warning because the task was called with ContinueOnError=true.
    1> Build continuing because "ContinueOnError" on the task "Exec" is set to "true".
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(756,5): error MSB8011: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions.
    1>Build FAILED.

    Does anybody know where this strange behaviour comes from?
    Thank you.

  • Hi, you're using 64-bit Windows, I think registration using RegSvr32 of old style ActiveX controls requires Admin privileges :-(

    One solution is to create a simple .cmd bat-file that just contains the RegSvr32 command, and launch it with "Run as Administrator"; as suggested "here":

  • you could also run Visual Studio as Administrator.

  • Lifetime Qt Champion

    @ kenchan that's a Bad Idea (™) You can break everything when developing as admin/root without even knowing it.

  • Thank you for your replies. Unfortunately, everything that has been suggested I have already tried. Nothing works.
    As I said: When I start VS with admin rights the registration works one time. Then I have to leave VS and start it again. Then it works again one time. Looks like some files are locked.
    But anyway: This worked only after having declared DllRegisterServer manually in the project, building the project and deleting the declaration again afterwards.

Log in to reply