Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mapping and Unmapping
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00137678
Message ID:
00137898
Views:
19
>Try the API call SetEnvironmentVariable, which prototypes as:
>
>
>   DECLARE SHORT SetEnvironmentVariable IN WIN32API ;
>           STRING lpName, ;
>           STRING lpValue
>
>lpName should be the name of the environment variable to set (in this case, "PATH"), and lpValue should be the full path value to set, null-terminated.  This only sets the enviroment variable in the context of the current process.

This is the entire code I have tried.<pre>
DECLARE Integer WNetAddConnection IN WIN32API STRING @, STRING @, STRING @

lcRemoteName = "\\R6Vabs\Vol1\OraApps\OraWin95\Bin" + chr(0)
lcPassword = ""    && Connect using no password, already authenticated
lcLocalName = "I:" + chr(0)

lnRetVal = WNetAddConnection( @lcRemoteName, @lcPassword, @lcLocalName)

*-- lnRetVal is 0 and I can verify that I: now exists to the path specified

DECLARE SHORT SetEnvironmentVariable IN Win32API;
   STRING @lpname, STRING @lpszValue
lcName = 'PATH'
lcPath = getenv("PATH") + ";I:." + Chr(0)
lnRresult = SetEnvironmentVariable(@lcname, @lcpath)
clear
?
?
? getenv("PATH")    && still shows old path
return
At the end of the rope at this point.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform