开发者

What is IDR_TYPELIB1?

I can't find any good resources online about what this is. It's required in one of the steps for deploying a .NET assembly for use by COM, but there is no detail what it is or what it means.

As an example, here is something from the book I'm reading on Interop:

Next you need to create a resource script MyExampleAssembly.res with the following statement:

(This gets run at the VS command prompt in the directory where you just exported your .NET component using the Type Library Exporter Utility)

IDR_TYPELIB1 typelib "MyExampleAssembly.tlb"

What is IDR_TYPELIB1?

Also, it's not working for me. I have tried running this and it doesn't compile. I get a message "'IDR_TYPELIB1' is not recognized as a开发者_运维百科n internal or external command".


It is a macro that's normally auto-generated when you use the unmanaged resource editor. Just use a constant, 1 is fine. You are also using the wrong tool to compile the resource script by the sound of it, you must run rc.exe. It translates your .rc file to a .res file that the C# compiler can use.

Embedding the type library is optional btw, it is not something that COM Automation requires. It is not a very good idea to do this in a managed project since the .tlb is generated after building the project. Instead of before, as happens in a native COM project. You create it with regasm.exe, /tlb option or the tlbexp.exe utility. Your client can do this too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜