Forum » Programiranje » Kdo je logiran v Win (VB)
Kdo je logiran v Win (VB)
strel ::
Rad bi prebral username od windows prijave.
To je ono nad START gumbom kjer piše Odjavi Strel...(recimo, da ne bo pomote)
Aja v Visual Basic-u
To je ono nad START gumbom kjer piše Odjavi Strel...(recimo, da ne bo pomote)
Aja v Visual Basic-u
TonaMona ::
V form vpiši spodnjo kodo. V spremenljivki UserName dobiš logiranjega uporabnika.
Option Explicit
Private Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
As Long
Dim lRes As Long
Dim cn As String
Dim ls As Long
Dim UserName As String
Private Sub Form_Load()
cn = String(1024, 0)
ls = 1024
res = GetUserName(cn, ls)
If res <> 0 Then
'očisti nesnago
UserName = Mid(cn, 1, InStr(cn, Chr(0)) - 1)
End If
Me.Caption=UserName 'prikaže ime v naslovu
End Sub
LP, Tone
Option Explicit
Private Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
As Long
Dim lRes As Long
Dim cn As String
Dim ls As Long
Dim UserName As String
Private Sub Form_Load()
cn = String(1024, 0)
ls = 1024
res = GetUserName(cn, ls)
If res <> 0 Then
'očisti nesnago
UserName = Mid(cn, 1, InStr(cn, Chr(0)) - 1)
End If
Me.Caption=UserName 'prikaže ime v naslovu
End Sub
LP, Tone
Zgodovina sprememb…
- spremenilo: TonaMona ()
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | C# težavaOddelek: Programiranje | 3685 (2531) | mladec |
» | COM in Visual BasicOddelek: Programiranje | 2164 (1625) | pexo |
» | Excel vprašanjeOddelek: Programiranje | 1131 (1030) | matic |
» | API+VBOddelek: Programiranje | 2081 (1785) | webblod |
» | Odpiranje dat.exe v VBOddelek: Programiranje | 2972 (2765) | webblod |