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
Solved

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

Posted on 2007-12-03
3
1,414 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
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…
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…

861 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