ttobin333
asked on
VB6: How to temporarily elevate to administrator privileges
Dear Experts,
My VB6 program needs to access the internet to register its license when running in standard user mode. How can I get Windows Vista to ask for administrator approval with the standard dialog box for this operation and then return to standard user privileges right afterward?
Thanks!
My VB6 program needs to access the internet to register its license when running in standard user mode. How can I get Windows Vista to ask for administrator approval with the standard dialog box for this operation and then return to standard user privileges right afterward?
Thanks!
I believe that you have to take an action that requires administrator privileges and windows will issue the authentication request automatically.
ASKER
Here's the problem: when the program tries to connect to the internet, Windows does not ask for admin approval, but the connection is blocked. This is not a problem when logged in with admin privileges.
ASKER
Thanks egl1044! I'm going to give it a try.
Uploaded the set of tools created to assist with elevations.
https://filedb.experts-exchange.com/incoming/ee-stuff/7778-vistauac.zip
https://filedb.experts-exchange.com/incoming/ee-stuff/7778-vistauac.zip
ASKER
Thanks! Will test it out tonight!
ASKER
Very sorry for delay--will complete testing within 1 day.
ASKER
egl1044, this looks like exactly what I need, but I could use some guidance in putting it together.
Can I use any GUID value that the generator you supplied creates?
I have never used COM objects...can you provide some additional guidance for a beginner?
Thanks!
Can I use any GUID value that the generator you supplied creates?
I have never used COM objects...can you provide some additional guidance for a beginner?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
ttobin333.
I would like to update you with a VB.NET version if you ever decide to move to VB.NET or already have done so for some projects.
https://www.experts-exchange.com/articles/Programming/Languages/.NET/Visual_Basic.NET/VB-NET-Vista-COM-Elevation.html
-egl
I would like to update you with a VB.NET version if you ever decide to move to VB.NET or already have done so for some projects.
https://www.experts-exchange.com/articles/Programming/Languages/.NET/Visual_Basic.NET/VB-NET-Vista-COM-Elevation.html
-egl
HI egl1044
I need some help to implement this in Acc2007 on a Win7 box, can you assist? I can open another Q, I need step by step intrux on how to use your vistauac.zip for Acc2007.
The problem I am having is with CreateObject in Acc2007 VBA code:
Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet" )
I get the 'requested operation requires elevation' msg
I need some help to implement this in Acc2007 on a Win7 box, can you assist? I can open another Q, I need step by step intrux on how to use your vistauac.zip for Acc2007.
The problem I am having is with CreateObject in Acc2007 VBA code:
Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet"
I get the 'requested operation requires elevation' msg
PS: egl1044,
BTW you article at
https://www.experts-exchange.com/articles/Programming/Languages/Visual_Basic/UAC-Elevation-in-Vista.html
is empty
BTW you article at
https://www.experts-exchange.com/articles/Programming/Languages/Visual_Basic/UAC-Elevation-in-Vista.html
is empty
Hi, LukeB
This won't work with what I think your trying to do.... It's for implementing COM elevation in your own COM/ActiveX dll's you compile. The reason it will fail is because there is strict requirments of registering the COM class for elevation something that you don't have control over with excel automation.
If you are using macros from within excel then I don't see a way around this unless you elevate the application itself using Run As Admin. However if you have access to VB6 where you can compile into an executable you "should" be able to elevate your process and use excel automation using early binding.
I recently removed all elevation articles for revision. I am in the process of re-working elevation into a toolkit for VB and .NET but there is no specific time frame when that will be finished.
This won't work with what I think your trying to do.... It's for implementing COM elevation in your own COM/ActiveX dll's you compile. The reason it will fail is because there is strict requirments of registering the COM class for elevation something that you don't have control over with excel automation.
If you are using macros from within excel then I don't see a way around this unless you elevate the application itself using Run As Admin. However if you have access to VB6 where you can compile into an executable you "should" be able to elevate your process and use excel automation using early binding.
I recently removed all elevation articles for revision. I am in the process of re-working elevation into a toolkit for VB and .NET but there is no specific time frame when that will be finished.