Solved

How can I register/unregister ActiveX controls without administrator privileges programatically?

Posted on 2007-12-03
3
1,410 Views
Last Modified: 2008-02-01
Our old C++/VFP application is setup to allow updating of the individual modules programmatically upon startup.  Some of these modules are ActiveX controls and the process works by calling DllUnregisterServer, replacing the ActiveX control and then calling DllRegisterServer entry points within each DLL.    The initial install works fine upon initial install and  registers the new files.  (even under Vista)

On subsequent updates to these modules however, Vista now brings up the annoying dialog requesting "elevation" for permission and will not update these files.   If I have the user run as Administrator, then none of these problems exist but the application now does not recognize some of the other ActiveX controls and returns a "Class not Registered" error when accessing them.  

So it appears as if I have no good alternative.... so any suggestions you have would be helpful.

Gregg Peele
0
Comment
Question by:GreggPeele
3 Comments
 

Author Comment

by:GreggPeele
Comment Utility
I think I've solve this issue after much research..  Hopefully it will help others that are attempting to accomplish this...

 

1. The programs that actually registers/unregisters the files can be elevated by using ShellExecuteEx instead of CreateProcess.  Using "runas" as the verb causes the use to be able to allow or reject execution at the elevated status.  This avoids the elevation error.  The following link supplied the way to do this with ShellExecute. I just modified it to use ShellExecuteEx.

 

http://weblogs.asp.net/kennykerr/archive/2006/09/29/Windows-Vista-for-Developers-_1320_-Part-4-_1320_-User-Account-Control.aspx

 

2. It was important that the execution of the program finish before continuing to the next line of code.   Using ShellExecuteEx provides a processID that can be used by WaitforSingleObject to wait for the process to complete before continuing.

 

Note that the user must still approve the escalation but at least it is possible to continue successfully.  

 

Gregg
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now