how to set environment variables

hi,

To change the environment variables in system we need to go to properties ,in properties we need to go to advanced and in that we are changing environment variables.But I want to change the envoironment variables in my system through vc++ program.so can you please tell me the way to do that.

I am doing in this way

DWORD dwRet, dwErr;
LPTSTR pszOldVal,ss;
BOOL fExist;
int BUFSIZE=70;

pszOldVal = (LPTSTR) malloc(BUFSIZE*sizeof(TCHAR));

dwRet = GetEnvironmentVariable(TEXT("IT_CONFIG_PATH"), pszOldVal, BUFSIZE);

if ( SetEnvironmentVariable(TEXT("IT_CONFIG_PATH"), TEXT("config1")))
{
ss="SetEnvironmentVariable success";
return TRUE;
}

but problem is i am getting the environment variable but i am unable to set environment variable to some value. above I tried to set to config1 but when i went to command prompt and giving the command env it's showing previous environment only. so can you please suggest me please..
[1045 byte] By [satish@123] at [2007-11-19 19:44:09]
# 1 Re: how to set environment variables
SetEnvironmentVariable ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setenvironmentvariable.asp) will affect current process (and child processes) only.

- petter
wildfrog at 2007-11-10 23:43:00 >
# 2 Re: how to set environment variables
It depends on the operating system you are on.

see my article (hint: you need to change registry keys)

http://www.dev-archive.com/Cpp/W-P/win32/tutorials/article.php/c10849
Darka at 2007-11-10 23:44:05 >
# 3 Re: how to set environment variables
The function:
SystemParametersInfo
might give you some help!
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/systemparametersinfo.asp
RasKalnikov at 2007-11-10 23:45:04 >