Advanced PowerBuilder

HomePrevious Lesson: Creating a Directory
Next Lesson: Setting the Computer Name

Finding the Computer Name

Declare a local external function as shown below.
FUNCTION boolean ufx_GetComputerName(ref string cname, &
         ref long nbuf) LIBRARY "Kernel32.dll" ALIAS &
         FOR "GetComputerNameA"

The following code displays your computer name.
// Object: cb_display_computer_name
// Event: Clicked
long ll_buf = 25
string ls_ComputerName = space( ll_buf )
ufx_GetComputerName(ls_ComputerName, ll_buf )
MessageBox("Computer name is:", ls_ComputerName)
HomePrevious Lesson: Creating a Directory
Next Lesson: Setting the Computer Name