[python-win32] SendMessageTimeout() ?

Carl Karsten carl at personnelware.com
Thu Jul 26 21:19:22 CEST 2007


I am pretty sure I need to call

SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
     (LPARAM) "Environment", SMTO_ABORTIFHUNG,
     5000, &dwReturnValue);

And can't figure out how.

Here is the background of what/why:

I am trying to "add a dir to the windows search path."

Apparently this is a two step process:
1) add dir to reg key,
2) make win notice the new value.

Here is my #1.

from _winreg import *
...
h = OpenKeyEx( hive, key, 0, KEY_SET_VALUE )
NewPath = curPath + ';' +  DirToAdd
SetValueEx(h, 'path', 0, REG_EXPAND_SZ, NewPath )
CloseKey(h)

I am basing my step 2 on:
"... modifications to the environment variables do not result in immediate 
change .... To effect these changes ... broadcast a WM_SETTINGCHANGE message..."
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q104011

Carl K


More information about the Python-win32 mailing list