Predmet:Re: User Name & Local PC Name API
Ovo na vrhu modula
PreuzmiIzvorni kôd (Visual Basic):Declare Function KorisnikK Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Ovo u modulu
PreuzmiIzvorni kôd (Visual Basic):Function ImeKorisnika() As Variant
'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
'FUNKCIJA ZA ITANJE IMENA KORISNIKA RAUNARA
'AutorZXZ
'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
'--------------------------------------------------------------------------------------------------------------
'TREBA DEKLARISATI OVAJ DLL (Vidi po
etak modula)
'Declare Function KorisnikK Lib "advapi32.dll" Alias "GetUserNameA" _
'(ByVal lpBuffer As String, nSize As Long) As Long
'--------------------------------------------------------------------------------------------------------------
On Error GoTo scoKorisnikK_Err
Const strProcName As String = "KorisnikO"
Dim intProcErrResp As Integer
Dim strOSUName As String
Dim lngLength As Long
Dim lngResult As Long
strOSUName = String$(255, 0)
lngLength = 255
lngResult = KorisnikK(strOSUName, lngLength)
ImeKorisnika = Left$(strOSUName, InStr(1, strOSUName, Chr(0)) - 1)
KorisnikO_Exit:
Exit Function
scoKorisnikK_Err:
MsgBox "Error " & Err.Number & ": " & Err.Description, vbInformation, "Error in " & strProcName, "Ime Baze"
Resume KorisnikO_Exit
End Function
Ovo je sa API procedurom
a ovo je sa naredbom Environ
Procedura:
PreuzmiIzvorni kôd (Visual Basic):Function InfoSIS(Naziv As String)
Dim EnvString, Indx, I
Do
Indx = Indx + 1
EnvString = Environ(Indx)
I = InStr(1, EnvString, Naziv, vbTextCompare)
If I = 1 Then
InfoSIS = Mid(EnvString, Len(Naziv) + 2)
GoTo Kraj
End If
Loop Until EnvString = ""
Kraj:
End Function
Primjer poziva:
Function poziv()
MsgBox InfoSIS("username")
End Function
E sad sta pisati u naziv kao ulazni parametar.
Evo spisak:
ALLUSERSPROFILE
AMDAPPSDKROOT
APPDATA
CM2014DIR
COMMANDER_DRIVE
COMMANDER_EXE
COMMANDER_INI
COMMANDER_PATH
CommonProgramFiles
CommonProgramFiles(x86)
CommonProgramW6432
COMPUTERNAME
ComSpec
FP_NO_HOST_CHECK
HOMEDRIVE
HOMEPATH
ILBDIR
LOCALAPPDATA
LOGONSERVER
MOZ_PLUGIN_PATH
NUMBER_OF_PROCESSORS
OS
Path
PATHEXT
PROCESSOR_ARCHITECTURE
PROCESSOR_ARCHITEW6432
PROCESSOR_IDENTIFIER
PROCESSOR_LEVEL
PROCESSOR_REVISION
ProgramData
ProgramFiles
ProgramFiles(x86)
ProgramW6432
PSModulePath
PUBLIC
SESSIONNAME
SystemDrive
SystemRoot
TEMP
TMP
USERDOMAIN
USERDOMAIN_ROAMINGPROFILE
USERNAME
USERPROFILE
VBOX_MSI_INSTALL_PATH
WecVersionForRosebud.E74
windir
Podrška samo putem foruma, jer samo tako i ostali imaju koristi od toga.
Ovaj post je ureden
2
puta. Posljednja izmjena 06.10.2015 18:52 od strane zxz.