UINT GetWindowsDirectory( LPTSTR lpBuffer, // buffer for Windows directory UINT uSize // size of directory buffer );Is declared in VFP like this:
DECLARE Integer GetWindowsDirectory IN win32api AS GetWindowsDirectory ; string @ cBuffer, ; Integer nSizeusing Integer for UINT, and a character variable *by reference* where the API wants a pointer to a buffer. The variable names in the declaration are optional, and don't need to be the same as the ones you actually use.
cWinDir = space(255) nSize = len(cWinDir)Then call the function. Note the @, which passes cWinDir by reference
nPathLength = GetWindowsDirectory(@cWinDir, nSize)GetWindowsDirectory returns the lengh of the string it put in the buffer, so use it to trim off the extra characters padding out your variable
cWinDir = left(cWinDir, nPathLength)
Hope that helps.