I set environment variable in the registry using InnoSetup:
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "MY_PROGRAM_HOME_DIR"; ValueData: "{app}"
But system cannot see this variable until I call SendMessage.
[Code]
procedure DeinitializeSetup();
begin
// HWND_BROADCAST = $FFFF
// WM_SETTINGCHANGE = $001A
SendMessage($FFFF, $001A, 0, Longint(PChar('Environment')));
end;
InnoSetup says:
… Column 60: Type mismatch
How do I correctly typecast PChar into Longint in InnoSetup script?
Use the
ChangesEnvironmentdirective instead of doing the same from your script code. From the reference:In InnoSetup, when you use the above directive, the following code is called inside: