juno.com.client Module

Provides additional support for COM (Component Object Model).

Licence
See licence.txt for use and distribution terms.

class DispatchObject;

Represents a late-bound COM object.

Examples
Automating CDOSYS:
 // Create an instance of the Message object
 scope message = new DispatchObject("CDO.Message");

 // Build the mail message
 message.set("Subject", "Hello, World!");
 message.set("TextBody", "Just saying hello.");
 message.set("From", "me@home.com"); // Replace 'me@home.com' with your email address
 message.set("To", "world@large.com"); // Replace 'world@large.com' with the recipient's email address

 // Configure CDOSYS to send via a remote SMTP server
 scope config = message.get("Configuration");
 // Set the appropriate values
 config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/sendusing", 2); // cdoSendUsingPort = 2
 config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25);
 config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/smtpserver", "mail.remote.com"); // Replace 'mail.remote.com' with your remote server's address
 config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1); // cdoBasic = 1
 config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/sendusername", "username"); // Replace 'username' with your account's user name
 config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); // Replace 'password' with your account's password

 scope fields = config.get("Fields");
 fields.call("Update");

 message.call("Send");
Automating Microsoft Office Excel:
 void main() {
   // Create an instance of the Excel application object and set the Visible property to true.
   scope excel = new DispatchObject("Excel.Application");
   excel.set("Visible", true);

   // Get the Workbooks property, then call the Add method.
   scope workbooks = excel.get("Workbooks");
   scope workbook = workbooks.call("Add");

   // Get the Worksheet at index 1, then set the Cells at column 5, row 3 to a string.
   scope worksheet = excel.get("Worksheets", 1);
   worksheet.set("Cells", 5, 3, "data");
 }
Automating Internet Explorer:
 abstract final class InternetExplorer {

   static class Application : DispatchObject {

     this() {
       super("InternetExplorer.Application");
     }

     void visible(bool value) {
       set("Visible", value);
     }

     bool visible() {
       return get!(bool)("Visible");
     }

     void navigate(string url) {
       call("Navigate", url);
     }

   }

 }

 void main() {
   scope ie = new InternetExplorer.Application;
   ie.visible = true;
   ie.navigate("www.google.com");
 }

this(Guid clsid, ExecutionContext context = cast(ExecutionContext)1u | cast(ExecutionContext)4u);



this(Guid clsid, string server, ExecutionContext context = cast(ExecutionContext)1u | cast(ExecutionContext)16u);



this(string progId, ExecutionContext context = cast(ExecutionContext)1u | cast(ExecutionContext)4u);



this(string progId, string server, ExecutionContext context = cast(ExecutionContext)1u | cast(ExecutionContext)16u);



this(IDispatch target);
this(VARIANT target);



final void release();



R call(R = DispatchObject)(string name,...);



R get(R = DispatchObject)(string name,...);



void set(char[] name,...);



void setRef(char[] name,...);



final IDispatch target();



final VARIANT result();



class EventCookie(T);



this(IUnknown source);



void connect(IUnknown sink);



void disconnect();



class EventProvider(T): Implements!(T);



this(IUnknown source);



template bind(ID,R,P...)



void bind(ID member, R delegate(P) handler);