« Whidbey FTP Support | Main | Application Settings Bindings in Windows Forms »

Why does InvokeRequired return false when you'd like it to return true?

I’ve seen a number of developers surprised by InvokeRequired returning false in situations when they know it’s a cross thread call.

The reason is that the underlying window handle associated with the control has not been created yet at the time of the call.

Since InvokeRequired is meant to be used with either BeginInvoke or just Invoke, and neither of these methods can succeed until a windows message pump gets associated with the control, it elects to return false.

 

 

 

Comments

It is kinda weird seeing a page where the content is about developing being close to 1 mb in size.

Huh?

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)