📄 subject_28231.htm
字号:
<p>
序号:28231 发表者:大个的萝卜 发表日期:2003-01-19 17:24:34
<br>主题:请问vc程序怎么修改系统的环境变量(win2000系统)
<br>内容:实现目标是:<BR>程序启动时,生产程序需要的局部环境变量,并指向一个新建的目录<BR>程序关闭时,撤销该局部变量,并同时删除新建的目录<BR>请问该怎么实现?先行谢过了
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:songxinye 回复日期:2003-01-19 17:32:18
<br>内容:SetEnvironmentVariable<BR>The SetEnvironmentVariable function sets the value of an environment variable for the current process. <BR><BR>BOOL SetEnvironmentVariable(<BR> LPCTSTR lpName, // address of environment variable name<BR> LPCTSTR lpValue // address of new value for variable<BR>);<BR> <BR>Parameters<BR>lpName <BR>Pointer to a null-terminated string that specifies the environment variable whose value is being set. The operating system creates the environment variable if it does not exist and lpValue is not NULL. <BR>lpValue <BR>Pointer to a null-terminated string containing the new value of the specified environment variable. If this parameter is NULL, the variable is deleted from the current process's environment. <BR>Return Values<BR>If the function succeeds, the return value is nonzero.<BR><BR>If the function fails, the return value is zero. To get extended error information, call GetLastError. <BR><BR>QuickInfo<BR> Windows NT: Requires version 3.1 or later.<BR> Windows: Requires Windows 95 or later.<BR> Windows CE: Unsupported.<BR> Header: Declared in winbase.h.<BR> Import Library: Use kernel32.lib.<BR> Unicode: Implemented as Unicode and ANSI versions on Windows NT.<BR><BR>See Also<BR>Processes and Threads Overview, Process and Thread Functions, GetEnvironmentVariable <BR><BR> <BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:大个的萝卜 回复日期:2003-01-19 17:57:13
<br>内容:多谢了,我先去试一试<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -