2005/5/10

     
 

acdkx_com Manual

artefaktur

ACDK COM+ provides an interface from ACDK to Windows COM and vice versa.


Sub chapter pages:

To use ACDK Objects from COM the COM server has to be registered.

ACDK COM+ provides an interface from ACDK to Windows COM and vice versa.

ACDK COM+ provides an interface from ACDK COM+ Clients to ACDK Objects.

How the types and interfaces of the COM word will be transated into the ACDK world.


Content of this chapter:

   Introduction
     COM as generic DMI server
     COM as generic DMI client



 Introduction

ACDK COM implements a DMI server and DMI client for ACDK.

 COM as generic DMI server

With DMI it is possible to Access COM object through all ACDK DMI clients, like C++, Java, Perl, Tcl, Python, Lisp, CORBA and so on.

A sample using perl as DMI client to access Ms Office Word application.


sub require_class($)
{
  my ($cls) = @_;
  my $cl = acdk::new("acdk/lang/ClassLoader");
  $cl->findClass($cls);
}

require_class('acdkx/com/ComObject');
$word = acdk::invoke_static('acdkx/com/ComObject', 'New', 'Word.Application');
$word->poke('Visible', 1);
$doc = $word->peek('Documents')->Add();
$sel = $word->peek('ActiveWindow')->peek('Selection');
$sel->TypeText("This is ");
$sel->peek('Font')->poke('Bold', 1);
$sel->TypeText("ACDK");
$sel->peek('Font')->poke('Bold', 0);
$sel->TypeText(" instrumenting Word through acdk_perl");
acdk::invoke_static('acdk/lang/Thread', 'sleep', 3000);
$word->Quit(0);

 COM as generic DMI client

On the other side acdkx_com enables all COM clients access to all DMI servers like all ACDK Objects, CORBA services, Java classes, and so on.

Sample which just uses an ACDK Object StringBuffer.


' visual basic HelloWorld example:
Sub HelloWorld()
  Dim obj As Object
  Set obj = CreateObject("Acdk.Object")
  Dim sb As Object
  Set sb = obj.New("acdk/lang/StringBuffer", "Hallo")
  sb.append " from COM"
  
  MsgBox sb.toString()
  'alternativelly also: MsgBox sb.Invoke("toString") 
End Sub