Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Declare command and Win32API Problem
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00161279
Message ID:
00161341
Views:
20
>I have a problem getting the GetWindowsDirectory function to return the Windows dir in VFP6. It keeps returning 0. Can anyone help me with the correct syntex.

Try the following:
FUNCTION GetWinDir
DECLARE INTEGER GetWindowsDirectory IN Win32API ;
  STRING  @cLocation, ;
  INTEGER nSize
LOCAL cLocation, nSize

cLocation = SPACE(256)
nSize = GetWindowsDirectory(@cLocation, 256)

IF nSize > 0
   *
   * Got it - it's the size of the return
   *
   cLocation = LEFT(cLocation,nSize)
ELSE
   *
   *  An error occurred when retrieving the value - return the null string
   *
   cLocation = ''
ENDIF

return cLocation
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform