Re: wich user is logged on?
From: sentinel (support_at_elma.hr)
Date: 02/25/05
- Next message: playwin: "Re: URLMON"
- Previous message: J French: "Re: Printing stops with USB to Serial adapter"
- In reply to: Tony Proctor: "Re: wich user is logged on?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 25 Feb 2005 09:34:08 +0100
Tony Proctor wrote:
> If you're looking for a name to use as a key in a validation table
> (deduced from your other posts) then I'd recommend GetUserNameEx
> instead. This returns any domain name and will allow you to
> distinguish similar account names that may belong to different
> domains, or be local accounts.
>
> Tony Proctor
>
> "sentinel" <support@elma.hr> wrote in message
> news:xn0dyt839hkbmd004@news.t-com.hr...
> > Mike D Sutton wrote:
> >
> > > Private Declare Function GetUserName Lib "AdvAPI32.dll" Alias _
> > > "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As
> > > Long
> > >
> > > Private Sub Form_Load()
> > > Debug.Print """" & UserName() & """"
> > > End Sub
> > >
> > > Private Function UserName() As String
> > > Dim BufLen As Long
> > >
> > > Call GetUserName(vbNullString, BufLen)
> > > If (BufLen) Then
> > > UserName = Space$(BufLen)
> > > Call GetUserName(UserName, BufLen)
> > > UserName = TrimNull(UserName)
> > > End If
> > > End Function
> > >
> > > Private Function TrimNull(ByRef inString As String) As String
> > > Dim NullPos As Long
> > >
> > > NullPos = InStr(1, inString, vbNullChar)
> > > If (NullPos) Then TrimNull = Left$(inString, NullPos - 1) Else
> > > TrimNull = inString End Function
> >
> > That's it!!... thanks!
here is the whole project...
I have a set of programs used in my company
each and every one of then has a login and password prompt on startup
they all use the same db for authenticating but everyone is tired of
entering their username and pwd and since the comp asks for password go
come out of standby i figure that it is enough to enter the username
and password only once
now i must eather see who is logged in and ask them for their password
only once and all other applications will ask this application if they
can be ran (user privilegies and password validation...)
or i must use msgina.dll (some kind of replacment) that will do my
authentication at the same time as windows and tamporary store
information of user privilegies somewhere...
(securiti polici of ms does'nt do it for me because exe can be renamed
and/or copyed to another machine and ran from there but app must detect
that it can't be ran on that machine and automaticly close)
Tomislav
- Next message: playwin: "Re: URLMON"
- Previous message: J French: "Re: Printing stops with USB to Serial adapter"
- In reply to: Tony Proctor: "Re: wich user is logged on?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|