?
Solved

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

Posted on 2007-12-03
3
Medium Priority
?
1,425 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Author Comment

by:GreggPeele
ID: 20404984
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
ID: 20560253
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Suggested Courses

765 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