홈 · 개발 참고자료

개발 참고자료

[PowerBuilder] Get Windows username - PowerBuilder 윈도우 유저

작성자
관리자
작성일
2022-03-14
조회
12775
분류
파워빌더
//Create a local external function

Function boolean GetUserName( ref string buffer, ref ulong buflen ) Library "advapi32.dll" Alias For "GetUserNameW"

//Write the below code to get the windows username//You can associate the code to MessageBox / single line edit's text
// Here I am displaying the winusername in text box

// Object :: button
// event clicked
// display username in sle_1

ULong lul_buffer=100
String ls_winusr

ls_winusr = Space(100)
IF NOT GetUserName(ls_winusr, lul_buffer) THEN
ls_winusr = "User unknown"
END IF

sle_1.text=ls_winusr