Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

need COM support

Moderators: kris

Posted: 09/18/07 21:49:38 Modified: 09/18/07 22:08:35

COM is a great thing that on Windows. there is a COM library with Phobos under the MIT licence: http://www.dsource.org/projects/juno

the tlbimpd tool can generate a source module from a COM type library. see: http://www.dsource.org/projects/juno/wiki/Tutorials/Automation

add COM support to Tango, only things to do is modify three module: juno.com.core, juno.com.client, juno.com.reflect for use with Tango

I'm new to D and Tango, would you please give me a hand ?

Author Message

Posted: 09/18/07 21:59:02

If it is a question of porting Phobos code to Tango, feel free to use these forums (or even this thread) or the IRC channel #d.tango on freenode to ask about details.

I assume you don't ask for COM support in Tango itself (COM's Windows only (at least in practice) nature makes it an unlikely thing to do in any case).

Posted: 09/18/07 22:15:09

Is it a possibility that add COM support in Tango itself ? I use COM with Phobos and Juno before, but I really like Tango, want to switch to Tango now.

Posted: 09/18/07 22:38:55

I am in no way familiar with COM, so I wouldn't know what would be required to add such support to Tango. Is it just a question of adding the correct ported headers? If so please add a wishlist ticket :)

Posted: 09/18/07 22:54:57

Thanks!

To add COM support to Tango, Just wrap some Windows api.

The Juno's tlbimpd tool can generate correct D type COM headers automatically.

Posted: 09/19/07 03:06:28

Would the tlbimpd tool need to be in Tango also? Or can it reside elsewhere?

Also, specifically which Win32 API's need to be wrapped?

thx

Posted: 09/19/07 05:16:52 -- Modified: 09/19/07 05:33:04 by
yidabu -- Modified 5 Times

The best thing is tlbimpd tool to be in Tango also, if not, The Juno's author John maintain the tlbimpd tool now:

How easy control COM object by use Juno with Phobos, I think Tango can do it better:
Example, run command line on Windows to get COM header(type library) of IE:

tlbimpd.exe SHDOCVW.DLL /propput:put /comments   

Generated shdocvw.d contains:

abstract class InternetExplorer {
  static GUID CLSID = 
    { 0x0002df01, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 };
  mixin CoInterfaces!(IWebBrowser2, IWebBrowserApp);
}

Just 2 line code to run a IE instance:

IWebBrowser2 ie = InternetExplorer.coCreate!(IWebBrowser2)(ExecutionContext.LocalServer); 
scope(exit) 
{ 
    ie.Quit();    
    tryRelease(ie);             
} 
ie.put_Visible(VARIANT_TRUE); 

In juno.com.core, CoInterfaces? wrapped Windows api CoCreateInstance?. More details, see: http://svn.dsource.org/projects/juno/trunk/juno/com/

source of tlbimpd: http://svn.dsource.org/projects/juno/trunk/tools/tlbimpd/
download tlbimpd: http://svn.dsource.org/projects/juno/downloads/tools/

Posted: 09/19/07 05:36:09

Oh, it's John Chapman's code?

Heck, if John is interested in having this available within Tango, then yes ... we should definitely talk with John about how to do that :)

Posted: 09/19/07 06:04:43

That's great!

I'm waiting for the good news!