Reputation: 199
i'm learning about COM through an internet tutorial(http://www.codeguru.com/cpp/com-tech/activex/tutorials/article.php/c5567/Step-by-Step-COM-Tutorial.htm). The first thing is creating a IDL file and compile it to create another 5 files. The detail is after:
Add IAdd.idl file with the content
import "unknwn.idl";
[ object, uuid(1221db62-f3d8-11d4-825d-00104b3646c0), helpstring("interface IAdd is used for implementing a super-fast addition Algorithm") ]
interface IAdd : IUnknown { HRESULT SetFirstNumber(long nX1);
HRESULT SetSecondNumber(long nX2); HRESULT DoTheAddition([out,retval] long *pBuffer); };
[ uuid(3ff1aab8-f3d8-11d4-825d-00104b3646c0), helpstring("Interfaces for Code Guru algorithm implementations .") ] library CodeGuruMathLib { importlib("stdole32.tlb"); importlib("stdole2.tlb");
interface IAdd; }
After that, follow the tutorial, if i compile IAdd.idl file, it will generate:
--IAdd.h Contains the C++ style interface declarations.
--dlldata.c Contains code for proxy DLL. Useful when invoking the object on a different process/computer.
--IAdd.tlb Binary file , with a well defined format that completely describes our interface IAdd along with all it's methods. This file is to be distributed to all the clients of our COM component.
--IAdd_p.c Contains marshalling code for proxy DLL. Useful while invoking the object on a different process/computer.
--IAdd_i.c Contains the interface IIDs
but when i compile IAdd by right click it and choose compile in shortcut menu, there is no file being generate. But when open view class, i can see IAdd interface with some method.
I also try it by compile it manually by download midl.exe from internet and run in command line but it failed.
I fine a lot of material by google and all said that i can compile idl file by visual studio but i try many time, on my both computer but no file being generate after i compile idl file. I also install new Win7, new visual studio 2010 ultimate but nothing change.
Upvotes: 1
Views: 4499
Reputation: 276
I just created a new project and created a new idl file with the code you specified.If i right click and choose compile it works just fine (VS2010 Ultimate).
Did you choose the correct filetype in the fileproperties of VS?
It should be "IDL File".
Have you used the VS Command Prompt as you tried to compile it manually?
(The VS Command Prompt will set all necessary environment variables)
Upvotes: 3