artefaktur
software engineer &        architecture

 
 
 
 

acdkx::com::AcdkObject Manual

| Install | acdkx::com::ComObject man | acdkx::com::AcdkObject | Type mappings |


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


Content of this chapter:

   Introduction
   DMI interface



 Introduction


The class acdkx::com::AcdkObject implements a DMI interface for COM clients like C++, Visual Basic, Java, VB-Script and JavaScript.



' 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

 DMI interface




' Sample using vbs
' please refer to acdkx_com/tests/acdkx/com/acdkx_com_AcdkObject_Test.vbs
Sub dmiTest()
  Dim obj
  ' for accessing static methods or member you also
  ' need an instance of an AcdkObject, becuase COM doesn't
  ' know the concept of static members/methods.
  Set obj = CreateObject("Acdk.Object")
  Dim i
  ' write access a static member
  obj.poke_static "acdk/tools/aunit/DmiTestClass", "pubStaticInt", 42
  ' read access a static member
  i = obj.peek_static("acdk/tools/aunit/DmiTestClass", "pubStaticInt")
  
  testAssert (i = 42), "poke_static or peek_static"
  'MsgBox "getPubStaticInt: " & i
  
  ' invoke a static method of a class
  i = obj.invoke_static("acdk/tools/aunit/DmiTestClass", "getPubStaticInt")
  testAssert (i = 42), "invoke_static"
  
  Dim d
  
  ' create an instance of the class acdk/tools/aunit/DmiTestClass
  Set d = obj.New("acdk/tools/aunit/DmiTestClass", "Test", 0)
  
  ' access the member pubInt of this object
  i = d.peek("pubInt")
  
  testAssert (i = 0), "peek"
  
  ' write the member value 
  d.poke "pubInt", 43
  ' and read it again
  i = d.peek("pubInt")
  testAssert (i = 43), "poke"
  
  ' object member can also be accessed directly 
  ' via name:
  
  ' write member
  d.pubInt = 42
  ' read member
  i = d.pubInt
  
  testAssert (i = 42), "poke/poke direct over name"
End Sub

 
Last modified 2005-05-08 22:31 by SYSTEM By Artefaktur, Ing. Bureau Kommer