Click here to Skip to main content
15,914,419 members
Home / Discussions / C#
   

C#

 
QuestionDo you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 16:39
JoeRip4-Jan-07 16:39 
AnswerRe: Do you know of a MS COM object that raises events? Pin
Phillip M. Hoff4-Jan-07 18:15
Phillip M. Hoff4-Jan-07 18:15 
GeneralRe: Do you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 18:34
JoeRip4-Jan-07 18:34 
GeneralRe: Do you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 18:41
JoeRip4-Jan-07 18:41 
GeneralRe: Do you know of a MS COM object that raises events? Pin
Phillip M. Hoff4-Jan-07 19:08
Phillip M. Hoff4-Jan-07 19:08 
GeneralRe: Do you know of a MS COM object that raises events? Pin
Phillip M. Hoff4-Jan-07 19:50
Phillip M. Hoff4-Jan-07 19:50 
GeneralRe: Do you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 20:04
JoeRip4-Jan-07 20:04 
GeneralRe: Do you know of a MS COM object that raises events? Pin
Phillip M. Hoff4-Jan-07 20:22
Phillip M. Hoff4-Jan-07 20:22 
The event handler may or may not be executed on the UI thread; it depends on the implementation of the COM object firing the event. (There are some other factors that come into play, too, but they just confuse the issue even more so I won't go into them.) I find that it is best to simply assume that events fired by third party COM objects will *not* occur on the UI thread and code accordingly. It's actually very easy to do. Every UI control (e.g. the Form class) has an InvokeRequired property. You can get the value at any time and it will tell you whether or not you need to use Invoke() in order to update the UI.

While I can't speak for the entire iTunes API, I was able to verify that at least the volume changed event is fired from a non-UI thread. I suspect that the same holds true for the rest of its events. Therefore, you should be using Invoke() at some point within your event handler before updating the UI.

-Phil
GeneralRe: Do you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 20:31
JoeRip4-Jan-07 20:31 
GeneralRe: Do you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 20:45
JoeRip4-Jan-07 20:45 
GeneralRe: Do you know of a MS COM object that raises events? Pin
Phillip M. Hoff4-Jan-07 21:05
Phillip M. Hoff4-Jan-07 21:05 
GeneralRe: Do you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 21:12
JoeRip4-Jan-07 21:12 
GeneralRe: Do you know of a MS COM object that raises events? Pin
Phillip M. Hoff4-Jan-07 21:25
Phillip M. Hoff4-Jan-07 21:25 
GeneralRe: Do you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 21:34
JoeRip4-Jan-07 21:34 
GeneralRe: Do you know of a MS COM object that raises events? Pin
Phillip M. Hoff4-Jan-07 21:45
Phillip M. Hoff4-Jan-07 21:45 
GeneralRe: Do you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 21:47
JoeRip4-Jan-07 21:47 
GeneralRe: Do you know of a MS COM object that raises events? Pin
Luc Pattyn5-Jan-07 4:22
sitebuilderLuc Pattyn5-Jan-07 4:22 
GeneralRe: Do you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 20:15
JoeRip4-Jan-07 20:15 
GeneralRe: Do you know of a MS COM object that raises events? Pin
JoeRip4-Jan-07 20:20
JoeRip4-Jan-07 20:20 
QuestionVirus Pin
Tyler454-Jan-07 15:45
Tyler454-Jan-07 15:45 
AnswerRe: Virus [modified] Pin
Vega024-Jan-07 16:06
Vega024-Jan-07 16:06 
AnswerRe: Virus Pin
leppie4-Jan-07 16:54
leppie4-Jan-07 16:54 
AnswerRe: Virus Pin
Christian Graus4-Jan-07 18:03
protectorChristian Graus4-Jan-07 18:03 
QuestionRe: Virus Pin
Tyler454-Jan-07 18:58
Tyler454-Jan-07 18:58 
AnswerRe: Virus Pin
Chris Buckett4-Jan-07 21:13
Chris Buckett4-Jan-07 21:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.