How do we talk with COM the language of events and delegates

I wrote this blog entry from a real world customer issue and noticed that how little documentation exists on this topic. I assume that you already know what is a source interface in COM and what are IConnectionPoint and IConnectionPointContainer interfaces. Please pick up any COM book to learn that (I would reccommend Essential COM by Don Box). Also, a familiarity…

3

Bitness of the loaded typelibrary

If you use LoadTypeLib or LoadTypeLibEx then Ole Automation always convert the typelibrary according to the process bitness. So if we load a 32 bit typelibrary using LoadTypeLib/LoadTypeLibEx in a 64 bit process then it will be automagically converted to a 64 bit typelib in memory and vice versa. As you may see that this…

0

Marshaling BSTRs in COM/Interop or P/Invoke

I saw people making mistakes with BSTR marshaling in the COM/Interop space. Unfortunately msdn does not have many good examples on this subject. I will share some specific code examples which may help. The examples are only for reference which may be made more robust as needed. What is so special about BSTR? As http://msdn2.microsoft.com/en-us/library/ms221105.aspx states BSTRs are…

4