DLLs with COM interface

BLS nanali at nospam-wanadoo.fr
Wed Dec 5 18:50:24 PST 2007


have a look at :
http://www.dsource.org/projects/juno/wiki/TypeLibraryImporter

you'll find worthfull COM information and a nice tool to automate this task.
HTH Bjoern

Henrik schrieb:
> Hello!
> 
> 
> I was reading up on http://www.digitalmars.com/d/dll.html#com regarding 
> how to call DLLs with a COM interface, since this is exactly what I am 
> struggling with.
> 
> I'm trying to interface with proprietary DLLs that I know expose COM 
> interfaces. Fortunately, I have the documentation for them so I know 
> exactly what methods they expose.
> 
> There is, for example trtCom.dll, which exposes a trtComMgr class, which 
>  has a method AboutBox(). I thought I'd start with calling that, since 
> it  takes no arguments and returns nothing.
> 
> Now, it said in the article mentioned above that COM objects and D 
> interfaces are virtually the same thing, so I tried this:
> 
> extern(Windows)
> {
>     interface MbtComMgr
>     {
>         void AboutBox();
> 
>     }
> }
> 
> But that wasn't very popular with the D compiler. It simply said:
> Error: need 'this' to access member AboutBox
> 
> What would be the proper way of accessing a COM DLL?
> 
> 
> The article said that "The sample code includes an example COM client 
> program and server DLL." What sample code is it talking about exactly? I 
> looked under C:\dmd\samples\d\mydll but found nothing that looks like an 
> example on this.
> 
> 
> Cheers!
> 
> Henrik


More information about the Digitalmars-d-learn mailing list