Hi

Have managed to further refine the UI thread problem reported in earlier
posts.

Basically the problems manifested themselves as UI deadlock and control
parenting exceptions when trying to initiate forms creation from a
background thread using a synchronization object. The synchronization object
is obtained by subclassing the System.Windows.Forms.Form class.

Using Spy++, it can be seen that when the synchronization object is used
from a background thread in order to create a new Form on the main UI
thread....

   then, even though the synchronization object and the Forms ctor report
the current thread as being the main UI thread, the Form is actually being
created on the background thread.

After the ISynchronizeInvoke::EndInvoke completes (inline wait on the
IAsyncResult), both the main form (launched on startup) and the new modeless
form fail to respond further to user input. Spy++ shows no message
processing activity on the respective windows.

Future attempts to interact with the modeless form from the background
thread either meet with an exception (cannot parent controls created on
another thread) or hang (probably because ISynchronizeInvoke::Invoke was
being used instead of ISynchronizeInvoke::BeginInvoke).

So my question now is...

Is it possably to initiate the creation of a modeless (to the main app form)
form from a background thread, and if so, how?

thanks

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to