When using .INI files it can be useful to know the location of the
windows directory, esp. with all the flavours of windows and different setups. In PBBrowse I use this so I know where to create the
PBBrowse.INI file. The external function declaration for PB goes like this:win16
FUNCTION INT GetWindowsDirectory( &
REF STRING ls_WindowsDirectory, INT cbSysPath) &
LIBRARY 'KERNEL.EXE'
win32
Function uint GetWindowsDirectoryA( &
ref string dirtext, uint textlen) &
library "KERNEL32.DLL"
Then in your code you can just say:
String ls_WinPath
ls_WinPath = Space( 128 )
GetWindowsDirectory( ls_WinPath, 128 )
Note windows expects the memory to be allocated for the string where it will copy the
windows directory to. We do that by making PowerBuilder create a blank string of 128
chars, the second parameter to the call tells window the maximum size of the buffer we
have allocated for it to use. |