PDA

View Full Version : Avoid restart on Win10 machine to update the PATH env ?



eladef
02-22-2016, 07:04 AM
Hi

I’m using InstallShield 2015 with Basic MSI project

When installing the setup on Win10 machine it seems that restart or logoff is needed for the path environment variable to be updated.
The path is updated with the .ism file under Environment Variables,
I tried using custom action that run this InstallScript code to avoid restart but it didn’t helped
Any ideas ?

function RefreshEnvironment(hMSI)

STRING sParam;
POINTER pParam, pResult;
LONG lResult;
begin

sParam = "Environment";
pParam = &sParam;
pResult = &lResult;

if (!SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, pParam, SMTO_ABORTIFHUNG, 100, pResult))
then

//SprintfBox(WARNING, "", "SendMessageTimeout failed in RefreshEnvironment, Error %d", GetLastError());
endif;
end;