类型转换:<br>var<br> P: PChar;<br> S:String;<br>begin<br> P:='abcdefg';<br> S:=P; //直接将Pchar类型变量的值赋给字符串类型的即可。<br>end;<br><br>至于GetUserName函数,自己看看以下这段帮助:<br>The GetUserName function retrieves the user name of the current thread. This is the name of the user currently logged onto the system. <br><br>BOOL GetUserName(<br><br> LPTSTR lpBuffer, // address of name buffer <br> LPDWORD nSize // address of size of name buffer <br> <br> <br><br>Parameters<br><br>lpBuffer<br><br>Points to the buffer to receive the null-terminated string containing the user's logon name. If this buffer is not large enough to contain the entire user name, the function fails. <br><br>nSize<br><br>Pointer to a DWORD that, on input, specifies the maximum size, in characters, of the buffer specified by the lpBuffer parameter. If this buffer is not large enough to contain the entire user name, the function fails. If the function succeeds, it will place the number of characters copied to the buffer into the DWORD that nSize points to. <br><br> <br><br>Return Values<br><br>If the function succeeds, the return value is nonzero, and the variable pointed to by nSize contains the number of characters copied to the buffer specified by lpBuffer, including the terminating null character. <br>If the function fails, the return value is zero. To get extended error information, call GetLastError.