Mikey
Mikey

Reputation: 61

How do I use a COM object from C?

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.

Upvotes: 1

Views: 220

Answers (2)

Hans Passant
Hans Passant

Reputation: 942187

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.

Upvotes: 1

Gangadhar
Gangadhar

Reputation: 1903

Code project has a lot of samples. A quick search gave me this article on COM in C.

Upvotes: 1

Related Questions