Re: Allowing a method to timeout

Peter Ritchie <[email protected]> Fri, 11 Jan 2008 15:34:31 -0500
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <LISTSERV%[email protected]>
You'd be sending that flag if the second bit of the fWinIni (last)
parameter is set.  My guess is that depending on the setting your
changing, Windows may send a WM_SETTINGCHANGE message regardless of what
you send in here.

You can verify that with Spy++ and watch for WM_SETTINGCHANGE when you can
SystemParameterInfo.

If that's what's causing the hang, then calling it on a background thread
will avoid the problem.  You'll have to deal with communicating back to
the main GUI thread that SystemParameterInfo has returned and what the
return value is.

If you are setting the second bit of fWinIni high, you can avoid the
problem by not doing that and broadcast WM_SETTINGCHANGE with
SendMessageTimeout...