Get Environment Variable Of Computer In PowerBuilder
Using ContextKeyword
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
//[Powerscript] ContextKeyword lcxk_base String ls_Path String ls_values[] This.GetContextService("Keyword", lcxk_base) lcxk_base.GetContextKeywords("path", ls_values) If UpperBound(ls_values) > 0 Then ls_Path = ls_values[1] Else ls_Path = "*UNDEFINED*" End If MessageBox('Info', "Environment Variable : " + ls_Path) |
Using API, For getting the value of environment variables, like PATH Using API
You must pre-allocate the string . (eg 2k)
If you need to set an enviroment variable:
1 2 3 |
//[External Function Declaration] Function Long GetEnvironmentVariableA(String lpszName, Ref String lpszValue, Long dwValue) Library "kernel32.dll" Function Int SetEnvironmentVariableA(String lpszName, Ref String lpszValue) Library "kernel32.dll" |
Good Luck!
Subscribe
Login
0 Comments
Oldest