The READIN Family Album
Me and Sylvia on the canal in Qibao (April 2011)

READIN

Jeremy's journal

Liberty is not a woman walking the streets, she is not sitting on a bench waiting for an invitation to dinner, to come sleep in our bed for the rest of her life.

José Saramago


(This is a page from my archives)
Front page
More recent posts
Older posts
More posts about:
COM and .NET Interoperability
Readings

Archives index
Subscribe to RSS

This page renders best in Firefox (or Safari, or Chrome)

🦋 IDispatch

My policy of reading COM and .NET Interoperability straight through from the beginning, rather than skipping the stuff I am familiar with, paid off yesterday when I found out something about programming the IDispatch half of dual interfaces, which had eluded me until now.

IDispatch is an interface which allows you to support method and property calls on arbitrarily named members, meaning the client does not have to load type info. A common use for it is the "dual interface", in which type info is exposed but clients are given a choice whether to call methods directly or through IDispatch::Invoke. I always have supported it (in situations where I needed it and was not using a tool like ATL for the implementation) by hand-coding a lookup table in Invoke and GetIDsOfNames, and putting no code in the other two member functions. This is a big pain, primarily because of all the parameter translation you have to do in Invoke; and not supporting GetTypeInfo is a problem too, though it never made a difference in the situations where I did this. (Also I only support GetIDsOfNames halfway.)

But it turns out COM exports three functions which you can use to implement IDispatch using the type library generated by the compiler from your IDL code. They are LoadRegTypeLib, DispGetIDsOfNames, and DispInvoke. I have never done any work really with type libraries but it is nice to know I could. Chapter 4, which I am starting today, is all about COM Type Information.

posted morning of Thursday, October 9th, 2003
➳ More posts about COM and .NET Interoperability
➳ More posts about Readings

Respond:

Name:
E-mail:
(will not be displayed)
Link:
Remember info

Drop me a line! or, sign my Guestbook.
    •
Check out Ellen's writing at Patch.com.

Where to go from here...

Friends and Family
Programming
Texts
Music
Woodworking
Comix
Blogs
South Orange
readinsinglepost