Advanced PowerBuilder

HomePrevious Lesson: Setting the Computer Name
Next Lesson: Finding the Volume Information

Reading the Value of an Environment Variable

Declare a local external function as shown below.
FUNCTION uLong ufx_GetEnvironmentVariable( String &
         lpszName, REF String lpszValue, &
         uLong dwcValue) library "Kernel32.dll" &
         ALIAS FOR "GetEnvironmentVariableA"

The following code displays the value of the environment variable specified in sle_env SingleLineEdit control.
// Object: cb_env
// Event: Clicked
String ls_val = Space(1000)
ufx_GetEnvironmentVariable( sle_env.text, ls_Val, 1001)
MessageBox( sle_env.text, ls_val )
HomePrevious Lesson: Setting the Computer Name
Next Lesson: Finding the Volume Information