Detecting UserLogon status
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Detecting UserLogon status

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
Laurie Comerford
Guest





Posted: Tue Jan 11, 2005 5:19 am    Post subject: Detecting UserLogon status Reply with quote

Hi,

Further to the discussion under
"Saving & Restoring User Info on Forms"

above, I'm wondering if there is an API to detect the user's log on status.

Is he an Administrator, a Power User, a Normal User, a Guest etc.?

I expect I could attempt to write to something to HKLM and process any error
which occurs, but this seems inelegant.


--


Laurie Comerford
CADApps
www.cadapps.com.au

Back to top
bcoward
Guest





Posted: Tue Jan 11, 2005 6:19 am    Post subject: Re: Detecting UserLogon status Reply with quote

Laurie,

To detect whether a user is administrator I've used the following code.

Bear in mind that this code needs a reference to the MS Windows Installer object library but I think will suite your needs. I've used it successfully with Novell and NT.

<CODE>
Dim objInst As WindowsInstaller.Installer
Dim objSession As WindowsInstaller.Session
Dim strGuid As String
Dim bIsAdmin As Boolean

' Won't instantiate using New keyword
Set objInst = CreateObject("WindowsInstaller.Installer")

With objInst
.UILevel = msiUILevelNone
strGuid = .Products(0)
Set objSession = .OpenProduct(strGuid)
End With

' Retrieve AdminUser property and convert to a boolean value
With objSession
bIsAdmin = CBool(.Property("AdminUser"))
End With

If bIsAdmin Then
' Do stuff
MsgBox ("You are an Administrator...")
Else
' Do nothing
MsgBox ("You are not an Administrator...")
End If

' Clean up
Set objSession = Nothing
Set objInst = Nothing
</CODE>


Hope this helps your wonderings.

Regards,

Bob Coward
CADS, Inc

800-366-0946
bcoward@mindspring.com
Back to top
Jorge Jimenez
Guest





Posted: Tue Jan 11, 2005 10:06 am    Post subject: Re: Detecting UserLogon status Reply with quote

I believe this can be acomplished using the
Windows Management Instrumentation (WMI) API

--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica

"Laurie Comerford" <laurie@DeleteThiscadapps.com.au> wrote in message
news:41e317bc_3@newsprd01...
Quote:
Hi,

Further to the discussion under
"Saving & Restoring User Info on Forms"

above, I'm wondering if there is an API to detect the user's log on
status.

Is he an Administrator, a Power User, a Normal User, a Guest etc.?

I expect I could attempt to write to something to HKLM and process any
error
which occurs, but this seems inelegant.


--


Laurie Comerford
CADApps
www.cadapps.com.au








Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Contact Us
Powered by phpBB