Re: Allowing a method to timeout
"Bhatnagar, Amit" <[email protected]> Fri, 11 Jan 2008 13:55:12 -0700
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <[email protected]> |
The value I am passing in for fWinIni is 0, so I guess that SPIF_SENDCHANGE is not being set. So then make my call to SystemParameterInfo on a background thread? -----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.