0

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.

Yogi Yang 007
  • 5,147
  • 10
  • 56
  • 77

3 Answers3

1

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.

Bob77
  • 13,167
  • 1
  • 29
  • 37
  • Thanks for your suggestions but unfortunately the plugin system that we have implemented will only recognize those plugins that exist in the Plugin Folder. So installing them it out of question. The software is very big and converting it to a .NET or any other dev platform is out of question at this point of time. – Yogi Yang 007 Aug 17 '11 at 04:26
1

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.

Community
  • 1
  • 1
Deanna
  • 23,876
  • 7
  • 71
  • 156
  • Thanks for this info but actually I was looking for so way to make this possible using the manifest file instead of changing the code of our software. – Yogi Yang 007 Aug 25 '11 at 05:33
  • but doing that means the user has to confirm each and every time they start you app for a one off action. It also opens the system up to security vulnerabilities and malware. Further to this, it makes the user blaze about the UAC prompt opening them up to further problems. – Deanna Aug 25 '11 at 06:20
0

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.

tcarvin
  • 10,715
  • 3
  • 31
  • 52