how to get OS userid or ProcessID

sharkdim

Member
i want to get the current operation system's userid or mfg/pro's process ID in unix or winnt system.
who can give me an advise ?
thanks
Yours Shark
 

wawoue

New Member
Hi,

Here's an altered snippet of what I use to retreive the user's login id under Win 2k/XP in Active Directory...

First, add the following API declaration to the definition section of your program :

PHP:
PROCEDURE GetUserNameA EXTERNAL "advapi32" :
DEFINE INPUT-OUTPUT PARAMETER lpBuffer AS CHAR.
DEFINE INPUT-OUTPUT PARAMETER nSize AS LONG.
DEFINE RETURN PARAMETER ReturnValue AS LONG.

Then, create and use the following function...

PHP:
FUNCTION getWinNTUserInfos RETURNS CHARACTER
( /* parameter-definitions */ ) :
DEF VAR sUserId AS CHAR INIT "" NO-UNDO.
DEF VAR iLength AS INT NO-UNDO.
DEF VAR iNoErreur AS INT NO-UNDO.
DEF VAR objUSer AS COM-HANDLE NO-UNDO.
 
/* Retreive user's login ID */
iLength = 128.
ASSIGN sUserId = FILL(" ":U,iLength).
RUN GetUserNameA (INPUT-OUTPUT sUserId, INPUT-OUTPUT iLength, OUTPUT iNoErreur) NO-ERROR.
ASSIGN sUserId = IF ERROR-STATUS:ERROR 
					THEN ?
					ELSE STRING(sUserId).
 
RETURN sUserId.
 
END FUNCTION.

Hope that'll help... ;)
 

W.Wulmsen

Member
A simple Progress program code I use is the following:


{mfdeclre.i}
display global_userid /* operating system */
mfguser /* QAD session userid */
.


More coding is never needed. These are session parameter also used
by the standard QAD Programs.

Suc6

William W.
 

willy

New Member
In MFGPRO 9.0 We can view the user info in 36.16.12 (user monitor inquiry), it will display information as informed by W.Wulmsen.
 
Top