views:

21

answers:

1

I have a COM object written in C# that is a toolbar for the Windows taskbar (implements IDeskSite). I want to either,

  1. Prevent the taskbar from being loaded if a certain application is running

  2. Allow the toolbar to unload itself in the case of an unhandled exception rather than allowing the exception to cause Explorer to crash

For #1, I know I can use a Mutex to check if the application is running, but I'm not sure how to prevent the COM object from continuing to be loaded by the explorer.exe process or how to notify the process that the object had an error and needs to be unloaded.

A: 

Let's talk about way #1. Look at interface IClassFactory - any(!) COM object is created either by default or by your implemented one. So just implement this in the way checking if class instance can be created

Dewfy