Sky Software Homepage LogicNP Software Knowledge Base And FAQ

 
Contact Product Support    SearchSearch      Subscribe to the RSS feed for this forum

INFO: Shell popups are not displayed when ShowPopup or Show methods are called from another thread.

 
Subscribe to the RSS feed for this forum  Forum Index -> ShellObjects.Net/WPF
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Mon Mar 31, 2008 11:35 am    Post subject: INFO: Shell popups are not displayed when ShowPopup or Show methods are called from another thread.

The shell popups created by the ShellPopupNotification component are displayed using the UI thread. Trying to show the popups using the ShellPopupNotification.ShowPopup or ShellPopup.Show methods fails if they are called from a different thread. This can occur in two scenarios and the workarounds are as follows :

1. You need to show popups from a background or worker thread.
In this case, call the ShellPopupNotification.ShowPopup or ShellPopup.Show methods in a helper method of an UI object such as a Form or a Control and call the Control.Invoke method in your background thread passing the helper method as the parameter.

2. You need to show popups from event handlers which are called from a different thread.
Some components such as System.Timers.Timer or System.Diagnostic.EventLog have events which are raised from a random thread from the thread pool. To force the event handlers of these events to be called from the UI thread, set the SynchronizingObject property of the Timer or EventLog to a form in your application. You can also create a dummy form solely for this purpose, but make sure that it's handle is created by accessing its Handle property as follows :
Intptr dummy = form.Handle;
Back to top
Display posts from previous:   
Forum Index -> ShellObjects.Net/WPF All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group