sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Propogating Environment Variables

Does Advanced Installer issue a WM_SETTINGCHANGE message for a project that includes environment variables being created?

Seems like the ones I've created in my project aren't recognized on my Windows XP VM until I reboot.

I've gotten around this my creating and hooking in my own Managed Custom Action DLL that issues the WM_SETTINGCHANGE message and that seems to work.

Thoughts from anyone else that might have come across this?

Thanks,
Scott
Scott Jeslis
Senior Software Engineer
Cicero, Inc.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Propogating Environment Variables

Hi Scott,
I've gotten around this my creating and hooking in my own Managed Custom Action DLL that issues the WM_SETTINGCHANGE message and that seems to work.
The environment variables should be available once the installation completes on a Windows XP machine without restart. The message should be sent automatically by Windows Installer unless a restart of the system is pending.

To clarify this, please read the second paragraph from this related MSDN article.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Philm
Posts: 11
Joined: Fri Feb 13, 2015 1:04 am

Re: Propogating Environment Variables

Hello!

Old thread, but still interesting issue.

I would like to communicate from a batch script with AI, so that AI recognizes that an environment variable was changed.

So the question is, if there is a possibility for that- e.g. to run a custom action which collects the changed environment variable (by a previous custom action)?

Best regards, Philip
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Propogating Environment Variables

Hi Philip,

Indeed, the modifications to the environment variables do not result in an immediate change. The list of environment variables is being loaded when the process is initialized but not refreshed. In order to have the newly created environment variable you can have a custom action that will force a refresh of the environment variables. Basically you need to broadcast a settings change message to all windows in the system so that any interested application can perform an update.

For details, please check the How to propagate environment variables to the system article.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”