Advanced PowerBuilder

HomePrevious Lesson: Displaying a URL in the Default Browser
Next Lesson: Finding Where the EXE is Running From

Finding the System Directory

Declare a local external function as shown below.
FUNCTION ulong ufx_GetWindowsDirectory(ref string &
         wdir, ulong buf) LIBRARY "kernel32.dll" &
         ALIAS FOR "GetWindowsDirectoryA"

The following code displays the system directory.
// Object: cb_display_system_dir
// Event: Clicked
ulong lul_buf = 144
string ls_WinDir = space( lul_buf )
ufx_GetWindowsDirectory(ls_WinDir, lul_buf)
MessageBox("Windows System Directory", ls_WinDir)
HomePrevious Lesson: Displaying a URL in the Default Browser
Next Lesson: Finding Where the EXE is Running From