Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting system directory???
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00431092
Message ID:
00431269
Views:
15
>>>>CAn anyone show me a sample to code to get the system directory??
>>>>
>>>>Thanks godzillion :)
>>>
>>>Gan,
>>>
>>>I don't know if you had a problem with getting this to work because of using information in the API section. Unfortunately, it's not correct, and there's no way for me to correct it. It shows
lcBuffer = SPACE(255)
>>>DECLARE INTEGER GetSystemDirectory IN WIN32API STRING, INTEGER
>>>lnNameLength = GetSystemDirectory(@lcBuffer, 255)
>>>lcSystemDir = LEFT(lcBuffer, lnNameLength-1)
>>>* Should be
>>>DECLARE INTEGER GetSystemDirectory IN WIN32API STRING @, INTEGER
>>>lcbuffer = SPACE(260) && Current size of MAX_PATH
>>>lnNameLength = GetSystemDirectory(@lcBuffer, 260)
>>>lcSystemDir = LEFT(lcBuffer, lnNameLength)
The value returned does not include the terminating null character.
>>
>>Hi George,
>>
>>Your code works fine. This code gives me data type mismatch error:
>>
>>oReg=createobject('Scripting.FileSystemObject')
>>? oReg.GetSpecialFolder(0)
>>
>>
>>What could be wrong?
>
>It returns a folder object reference not a string. Off the top of my head
oFolder = oReg.GetSpecialFolder(1)
>? oFolder.Path && The complete path (ie C:\WINDOWS\SYSTEM)
>? oFolder.Name && The folder name (SYSTEM)
Great, thanks a lot. I misundesrtood the Help...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform