Click to See Complete Forum and Search --> : URGENT PLEASE!!! How to create type library from DLL?
ilin
July 12th, 2001, 05:01 AM
I've create a dll using VB, which I defined a class containing all properties & functions. How can I create a type library file (in .idl format)? This file can then be register by running "midl file.idl". And what is the syntax of creating this file?
Ivy
Cakkie
July 12th, 2001, 06:37 AM
I don't think you can directly create IDL from VB, but there's a tool called OLEVIEW, which comes with VB6. This can be used to see the typelibrary of a dll in IDL. I'm not sure if you can export or copy/paste the IDL, if you can, you have the file you need.
This can then be used with MIDL, but I haven't done that, cause VB will do that for you, and will automatically register it when compiling. Also, the typelibrary of a dll is included in the dll itself, so if you have a dll, you just need to register it (like say using regsvr32), and it should find the typelibrary.
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
ilin
July 12th, 2001, 06:49 AM
Thx! I did get a type library generated by OLEVIEW also, however I need it in different format, which can be used in other languages. Do you know the exact syntax to creating it, what are the fields represent? Here is an example:
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(5A5AE77C-4A10-11D5-A54B-0000C0403AD3),
helpstring("It174spi Interface"),
pointer_default(unique)
]
interface It174spi : IUnknown
{
[propget, helpstring("property Unit")] HRESULT Unit([out, retval] BYTE *pVal);
[propget, helpstring("property Val")] HRESULT Val([out, retval] double *pVal);
[helpstring("method Info")] HRESULT Info(long *, BYTE *, BYTE *, BYTE *, BYTE *);
[helpstring("method Start")] HRESULT Start();
[propget, helpstring("property Serial")] HRESULT Serial([out, retval] long *pVal);
[propget, helpstring("property RecordingEnabled")] HRESULT RecordingEnabled([out, retval] BOOL *pVal);
[propput, helpstring("property RecordingEnabled")] HRESULT RecordingEnabled([in] BOOL newVal);
....
};
[
uuid(5A5AE770-4A10-11D5-A54B-0000C0403AD3),
version(1.0),
helpstring("t174dev 1.0 Type Library")
]
library T174DEVLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(5A5AE77D-4A10-11D5-A54B-0000C0403AD3),
helpstring("t174spi Class")
]
coclass t174spi
{
[default] interface It174spi;
};
};
Many thanks!
Ivy
ilin
July 12th, 2001, 06:52 AM
Thx! I did get a type library generated by OLEVIEW also, however I need it in different format, which can be used in other languages. Do you know the exact syntax to creating it, what are the fields represent? Here is an example:
Many thanks!
Ivy
Cakkie
July 12th, 2001, 07:10 AM
I'm sorry, but I don't know that much of IDL, but there's a help file (midl.hlp) which might help you out.
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
dfwade
July 12th, 2001, 07:51 AM
I don't know if this helps but I think it may give you what you are looking for.
Open your project and then click on project properties, select component and then click on remote server files. Then compile the project it will create a type library file for you.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.