| Author |
Message |
Laurie Comerford
Guest
|
Posted:
Tue Jan 11, 2005 5:19 am Post subject:
Detecting UserLogon status |
|
|
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 |
|
|
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 |
|
|
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 |
|
 |
|
|
|
|