This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: SendMessage hangs the installation
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 14, 2010
03:54 AM
SendMessage hangs the installation
When I send a message using SendMessage the installer hangs!
This problem has evidently been around for some time, so a version of send message with a timeout is propably expecting to much 😞
(not to mention a setenv() ) Frankly I'm a bit disappointed. This is pretty basic stuff for installers...
Do anyone have a suggestion for an alternative approach to set an environment variable, and not require a reboot to have it visible?
/****** set env variable*******/
szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
nResult = RegDBSetKeyValueEx(szKey, "USER_DOC_BUILD_TOOLS", REGDB_STRING, TARGETDIR ^ "\\buildtools\\", -1);
/**** Flush the registry to all applications ***/
#define WM_WININICHANGE 0x001A
szEnv = "Environment";
pEnv = &szEnv;
SendMessage (HWND_BROADCAST, WM_WININICHANGE , 0, pEnv );
This problem has evidently been around for some time, so a version of send message with a timeout is propably expecting to much 😞
(not to mention a setenv() ) Frankly I'm a bit disappointed. This is pretty basic stuff for installers...
Do anyone have a suggestion for an alternative approach to set an environment variable, and not require a reboot to have it visible?
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 14, 2010
09:51 AM
Please search these forums for "SendMessageTimeout"; I seem to remember seeing examples of prototyping and calling that Windows API function.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 14, 2010
10:15 AM
This works for me...
#define HWND_BROADCAST 0xffff
#define WM_SETTINGCHANGE 0x001A
svEnvironment = "Environment";
pEnvironment = &svEnvironment;
SendMessage ( HWND_BROADCAST,WM_SETTINGCHANGE,0, pEnvironment );
#define HWND_BROADCAST 0xffff
#define WM_SETTINGCHANGE 0x001A
svEnvironment = "Environment";
pEnvironment = &svEnvironment;
SendMessage ( HWND_BROADCAST,WM_SETTINGCHANGE,0, pEnvironment );
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 14, 2010
12:29 PM
This subject should be a sticky post 🙂
Use SendMessageTimeout for sure. We used to have a -NOBROADCAST on our InstallScript setup's command line because my predecessor didn't know anything but InstallScript built-in functions and certain companies do not know how to write software that can process the Windows Message correctly. One was a fairly large anti-virus company, to remain un-named.
Robert's old post:
http://community.flexerasoftware.com/showthread.php?p=424845&pp=1&post=2
Here's one way to implement it (I'm paraphrasing here, you may need to debug this). Also, HWND_BROADCAST and WM_SETTINGCHANGE are defined in InstallScript now and do not need to be defined in 2010, IIRC.
Use SendMessageTimeout for sure. We used to have a -NOBROADCAST on our InstallScript setup's command line because my predecessor didn't know anything but InstallScript built-in functions and certain companies do not know how to write software that can process the Windows Message correctly. One was a fairly large anti-virus company, to remain un-named.
Robert's old post:
http://community.flexerasoftware.com/showthread.php?p=424845&pp=1&post=2
Here's one way to implement it (I'm paraphrasing here, you may need to debug this). Also, HWND_BROADCAST and WM_SETTINGCHANGE are defined in InstallScript now and do not need to be defined in 2010, IIRC.
#define HWND_BROADCAST 0xFFFF
#define WM_SETTINGCHANGE 0x001A
#define SMTO_ABORTIFHUNG 0x0002
#define SMTO_TIMEOUT 50
prototype BOOL USER32.SendMessageTimeout(HWND, SHORT, SHORT, POINTER, SHORT, SHORT, POINTER);
function SetEnvVar(szName As STRING , szVal As STRING )
STRING szKey, szEnv ;
NUMBER nResult ;
POINTER pResult, pEnv ;
begin
szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
nResult = RegDBSetKeyValueEx(szKey, szName, REGDB_STRING, szVal, -1);
szEnv = "Environment";
pEnv = &szEnv;
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, pEnv, SMTO_ABORTIFHUNG, SMTO_TIMEOUT, pResult);
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 16, 2010
06:40 AM
Nice, so then all we need to do is check either of the return values and present the user with a hint that a reboot is required if it failes.
Thanks guys! I agree this should be made sticky. moreover the owners if the product should put this on their agenda!
BR
-Ole
Thanks guys! I agree this should be made sticky. moreover the owners if the product should put this on their agenda!
BR
-Ole