Loading
SendMessageTimeout not working
Good day all,

 

I have a problem, but I am not sure exactly when it started to manifest.

 

For years our installer made environment variables by creating the keys and then calling SendMessageTimeout(...), and it worked fine.

 

However, I discovered today that the SendMessageTimeout call seems to either (a) fail silently or (b) not have an effect.

 

Here is what I have:

 

define WM_SETTINGCHANGE 0x001A

 

define HWND_BROADCAST 0xffff

 

define SMTO_ABORTIFHUNG 0x0002

 

prototype BOOL USER.SendMessageTimeout(HWND, INT, INT, POINTER, INT, INT, POINTER);

 

function RefreshEnvironment()

 

STRING sParam;

 

POINTER pParam, pResult;

 

LONG lResult;

 

begin

 

sParam = "Environment";

 

pParam = &sParam;

 

pResult = &lResult;

 

if (!SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, pParam, SMTO_ABORTIFHUNG, 500, pResult))

 

then

 

BATCH_INSTALL = TRUE;

 

endif;

 

end;

 

 

The problem is that after the install finishes the environment is not updated, and a reboot is not triggered :confused:

 

Any ideas?

  • Solved it now by using SendMessageTimeoutA. I guess IS was calling the Unicode version, and I suspect my string parameter was not correct.

     

    The other option (need to verify) is to declare sParam as WSTRING.

Loading
SendMessageTimeout not working