Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
API to know users
Message
From
13/07/2000 10:26:11
 
 
To
12/07/2000 16:43:45
Victor Lapid
Phil. Long Distance Tel. Co.
Manila, Philippines
General information
Forum:
Visual Basic
Category:
Windows API functions
Miscellaneous
Thread ID:
00390569
Message ID:
00391804
Views:
18
>"im just checking the current user...

Here is a snippet from one of my proggies. Where "Someone I want to have access" is substitute usernames.
' Place in module general declarations
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Public Function gooduser() As Boolean
Dim lngSize As Long, strBuffer As String, strUserId As String, strDir As String
gooduser = True ' establish default
strBuffer = Space$(255)
lngSize = Len(strBuffer)
Call GetUserName(strBuffer, lngSize)
strBuffer = Left$(strBuffer, lngSize)
strUserId = Trim$(UCase$(Replace(strBuffer, Chr$(0), "")))

 If strUserId <> "Someone I want to have access" Then
    gooduser = False
    MsgBox "Unable to confirm Novell / NT User Security schema.", vbCritical, "Aborting Unauthorized Access"
End If

' Make sure they are on my network
strDir = Dir("\\myserver\mypublic\mysecretdir", vbDirectory)
If strDir = "" Then
    gooduser = False
    MsgBox "Unable to confirm Novell / NT Machine Security schema.", vbCritical, "Aborting Unauthorized Access"
End If

End Function

' ***** Out in your form or wherever

if not gooduser then 
      '"do not good user stuff"
end if
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform