Click here to Skip to main content
15,911,789 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
Hello,


Unfortunately due to time being against me I can not convert my VB6 application to VB.NET at this moment of time. As a result I am faced with this issue which is detailed below:

I have an application which is written in VB6. When this application is run by a client, it needs to exexcute a Regasm a dll. The issue here is the application has to be run as an administrator. I can not go to every client and change the checkbox “Run this application as an administrator”.

So, is there any api I can call in my vb6 code in order to detect that this check box is checked please?

Your help is very much appreciated.

Behzad.
Posted
Comments
Sergey Alexandrovich Kryukov 18-Jan-12 4:28am    
Interesting question, but I don't think this is a good approach. What do you want? Check this fact to say: "This application requires administrator privileges. Please run this application as administrator"?
--SA

#If Win16 Then
Public Declare Function IsUserAnAdmin Lib "shell32" Alias "#680" () As Long

#Else
Public Declare Function IsUserAnAdmin Lib "shell32" () As Long
#End If







Select Case IsUserAnAdmin()
Case 1:
' User is Admin

Case False:
'User is not Admin
End Select
 
Share this answer
 
Comments
Member1978 18-Jan-12 8:41am    
Hello manoj,
The issue I have is that the user has logged on as adminstrator, but when running my application on a window #7 platform, the check box "Run this program as an administrator" is UN-tick. As a result I can not run regasm on a particular dll.

Many thanks in advance,
Behzad.
 
Share this answer
 
Comments
Member1978 18-Jan-12 8:41am    
Many thanks for this. I am assuming this solution means that when I run the application, it automatically runs as an "Administrator" regardless of what the platform is. My issue is window #7.
Jephunneh Malazarte 18-Jan-12 8:38am    
yes it automatically run as administrator but for some there's a popup message or something that you need to click ok else it terminate the program... but i am not certain coz i stop doing support for vb6 since 2005
Member1978 18-Jan-12 8:43am    
Hello Jephunneh,

Many thanks. Please accept my apologies for sending you the same message.
Behzad

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900