Re: wich user is logged on?

From: sentinel (support_at_elma.hr)
Date: 02/25/05


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



Relevant Pages

  • Re: checking user name on a remote machine ???
    ... pick Manage and look at the Users listed in the Local Accounts? ... >> a remote machine: ... The second command will tell you if he is currently ... >>> wants to subscribe I need to check if his username already exists ...
    (microsoft.public.win2000.networking)
  • Re: checking user name on a remote machine ???
    ... pick Manage and look at the Users listed in the Local Accounts? ... >> a remote machine: ... The second command will tell you if he is currently ... >>> wants to subscribe I need to check if his username already exists ...
    (microsoft.public.windowsxp.work_remotely)
  • Re: How do I bind to LDAP with a username/password
    ... authenticating against an LDAP server with a username and password. ... Authentication against LDAP normally works by attempting to bind with the ... case I want to connect with master credentials and then run queries ...
    (comp.lang.java.programmer)
  • Re: Exchange 2003 POP3 authentication failure (bug?)
    ... users when authenticating with the DOMAIN\username format. ... even if duplicated usernames exist in multiple domains. ... format simply because Exch doesnt assume that the mailbox alias ... the username, it doesnt like it. ...
    (microsoft.public.exchange.admin)
  • Re: FormsAuthentication Fails
    ... Are you authenticating with username email@email.com? ... username which was used in authentication to RefirectFrom...... ... Matjaz Ladava, MCSE (NT4 & 2000) ... "Caroline Bogart" wrote in message ...
    (microsoft.public.dotnet.framework.aspnet.security)