I have a DLL containing a COM object that I'm trying to use. I couldn't find any good explanations of how to do so with C. It would be much appreciated if you guys could redirect me to a tutorial or something.
+1
A:
Code project has a lot of samples. A quick search gave me this article on COM in C.
Gangadhar
2010-08-28 15:01:11
+1
A:
Writing C code that uses a COM server is outlawed by the 'cruel and unusual punishment' clause in Article 5 of the Universal Declaration of Human Rights.
Should you elect to ignore this then try to get started by running OleView.exe, File + View TypeLib, select the DLL. That opens a window with the contents of the type library embedded in the DLL. Copy and paste the interface declarations into a .idl file. Run this through midl.exe, that produces a .h file that has C compatible declarations for the interfaces.
Hans Passant
2010-08-28 15:34:49
Eh, it's not _that_ much worse than C++. Apart from all the manual reference count juggling, that is. It's not nearly as bad as writing a COM _server_ in C, that's for sure...
bdonlan
2010-08-28 16:05:44
Getting the interface declarations is the problem. *Writing* a COM server in C is actually simpler.
Hans Passant
2010-08-28 16:08:48