Re: Allowing a method to timeout

"Bhatnagar, Amit" <[email protected]> Mon, 14 Jan 2008 10:18:55 -0700
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <[email protected]>
OK, now I am confused.

I looked at the Windows messages being received by my application's main
window and some child windows. Neither receives the WM_SETTINGCHANGE
method when I can SystemParameterInfo. 

Also, I changed the call to SystemParameterInfo to run on a background
thread, and terminate after a specified timeout. In some cases it does
timeout and Abort() gets called on the thread, yet it is still hanging
on the call to SystemParameterInfo.

any ideas?

-----Original Message-----
From: Discussion forum for developers using Windows Forms to build apps
and controls [mailto:[email protected]] On Behalf Of
Peter Ritchie
Sent: Friday, January 11, 2008 1:35 PM
To: [email protected]
Subject: Re: [DOTNET-WINFORMS] Allowing a method to timeout

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...

The information contained in this e-mail message is PRIVATE. It may contain confidential information and may be legally privileged. It is intended for the exclusive use of the addressee(s). If you are not the intended recipient, you are hereby notified that any dissemination, distribution or reproduction of this communication is strictly prohibited. If the intended recipient(s) cannot be reached or if a transmission problem has occurred, please notify the sender immediately by return e-mail and destroy all copies of this message. 
Thank you.