Creating ActiveX in D

John C johnch_atms at hotmail.com
Fri Jul 24 01:16:41 PDT 2009


BLS Wrote:

> John C wrote:
> > BLS Wrote:
> > 
> >> Hi,
> >> Sergey G. ask (by accident ;) ) about : How to create an ActiveX control 
> >> in D.
> >> Now, I am curious : Is it possible to create an ActiveX Control In D ?
> >>
> >> Something along :
> >> class Component : IDispatch
> >> {
> >> }
> >>
> >> instead of :
> >>
> >> class Component : IUnknown
> >> {
> >> }
> >>
> >> and if so, how to build an AX control in D, guess as DLL + D runtime ???
> >>
> >> Thank's for enlighten me.
> >> björn
> > 
> > I wouldn't, certainly not merely out of curiosity. It's a mountain of work, and you have to implement lots of pretty obscure interfaces. If you really must do it, find a C++ example and translate it to D.
> 
> 
> Thanks John,
> 
> If YOU don't give it a chance... then everything is lost.
> 
> another leak in D
> +

Well, I wouldn't go that far. It's just that some other languages have either built-in language support for ActiveX (VB, C#, Delphi) or libraries that do much of the legwork for you (eg, MFC/ATL/VCL). But I don't think these belong in the D language or its standard library.

It's relatively straightforward to create a COM server in a DLL and register a few classes with the system. Juno's (http://www.dsource.org/projects/juno) COM package shows how it can be done.

If you want to do something useful like show a window have allow the user to interact with it, you need to implement IOleObject, IOleControl, IOleInPlaceActiveObject, and so on (http://msdn.microsoft.com/en-us/library/aa751972(VS.85).aspx). And maybe IDispatch. And you need a UI library. So if you're feeling bold...

John.



More information about the Digitalmars-d mailing list