Environment variable not updated - SendMessage
Posted 14 September 2009 - 13:28
I add a new path to the environment variable PATH. After that i start a program who needs this PATH variable, but gets still the old one.
I found many posts where the people use:
sParam = "Environment";
pParam = &sParam;
pResult = &lResult;
if (SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, pParam) = 0) then
The SendMessage-Command returns SUCCESS, but i get no update. I tried now many hours in many ways, with SetRegValue, with batch-files and with setx.exe. (With and without delays)
For many people the SendMessage method works, so i must do something wrong.
OS: Windows XP SP3
Can anybody help me, please????
Edited by krakos, 14 September 2009 - 13:29.
Posted 22 September 2009 - 17:29
Can you provide more information on what you're trying to do?
Posted 23 September 2009 - 12:50
Within the setup i have to start an application (exe file) wich needs an entry in the PATH Enviroment-Variable. Its the path to the SQLBase server.
My working solution is following:
I wrote a batch file with input parameters. I read the enviroment variable with InstallScript and than i set it in the batch file. After that i start in the batch file the exe file, wich has now for this session the new enviroment variable. I also set it in the registry to have the variable after the setup available, too.
Sorry for my bad english.
The batch file:
%2\file.exe /filename=%3 /DBNAME=%4 /SETUP /SERVER=SERVER1 /CREATEDATABASE