/**********************************************************************/ /******** Example for Windows 95 or Windows NT ************************/ /* Use the following code on a Windows 95 or Windows NT client to update the DOS environment variable, VQPNAME. This code uses the external dll, GetUserName, a Win32 api. This api is called with the modulen function. *1* Data step to create the attribute table for GetUserNameA. Store attribute table in a text file to be referenced by the modulen function. The example uses the file winapi.txt in the current directory. The modulen function will use the fileref SASCBTBL. *2* Data step to execute the Win32 api external module 'GetUserNameA'. The module returns the current user's userid. The macro variable vqpname is updated with this value. *3* Now set the environment variable vqpname with the value stored in the macro variable vqpname. */ /****** Start of Code for WINDOWS 95 and WINDOWS NT example ***********/ /* *1* */ filename sascbtbl 'winapi.txt'; data _null_; file sascbtbl; input line $char80.; put line $char80.; cards4; routine GetUserNameA minarg=2 maxarg=2 stackpop=called module=advapi32 returns=short; arg 1 char update format=$cstr20; arg 2 num update format=pib4.; ;;;; run; /* *2* */ filename sascbtbl 'winapi.txt'; data _null_; length Name $20.; name=''; Size=20; rc=modulen('GetUserNameA',Name,Size); put rc= Name=; call symput('vqpname',name); run; /* *3* */ options set=vqpname &vqpname; /****** End of example for Windows 95 or Windows NT *******************/