Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: username DllCall Advapi32.DLL
dllname=strcat(dirwindows(1),"Advapi32.DLL") PTRBB=BinaryAlloc(100) ; allocate a memory buffer of n bytes a3 = 100 DllCall(dllname, lpstr:"GetUserNameA", lpbinary:PTRBB, long:a3) BinaryEODSet(PTRBB,100) ; set the end of a2=BinaryPeekStr(PTRBB, 0, 100) Message(a1,a2) BinaryFree(PTRBB)
dllname=strcat(dirwindows(1),"Advapi32.DLL") bufsize=100 PTRBB=BinaryAlloc(bufsize) ; allocate a memory buffer of n bytes PTRNAM=BinaryAlloc(4) BinaryPoke4(PTRNAM,0,bufsize) DllCall(dllname, long:"GetUserNameA", lpbinary:PTRBB, lpbinary:PTRNAM) BinaryEODSet(PTRBB,100) ; set the end of username=BinaryPeekStr(PTRBB, 0, 100) Message("Username",username) BinaryFree(PTRBB) BinaryFree(PTRNAM)
Article ID: W15134
File Created: 2002:09:05:13:49:52
Last Updated: 2002:09:05:13:49:52