home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 July / Chip_2002-07_cd1.bin / zkuste / delphi / kolekce / d3456 / AWSCRIPT.ZIP / awScript / d6_example / Unit2.pas < prev   
Pascal/Delphi Source File  |  1999-04-07  |  1KB  |  42 lines

  1. unit Unit2;
  2.  
  3. {
  4.     A simple Automation object to demonstrate scripting. It was created
  5.     by going to File>>New then selecting ActiveX>>AutomationObject. The
  6.     class was given the name awScriptTest and then it's methods and
  7.     properties were defined using the type library editor. Finally, the
  8.     code was filled in below to implement the methods and properties.
  9. }
  10.  
  11. interface
  12.  
  13. uses
  14.   ComObj, ActiveX, Project1_TLB;
  15.  
  16. type
  17.   TawScriptTest = class(TAutoObject, IawScriptTest)
  18.   protected
  19.     function Get_Name: WideString; safecall;
  20.     procedure AddToList(const Msg: WideString); safecall;
  21.     { Protected declarations }
  22.   end;
  23.  
  24. implementation
  25.  
  26. uses ComServ, Unit1;
  27.  
  28. function TawScriptTest.Get_Name: WideString;
  29. begin
  30.     Result := 'awScriptTest';
  31. end;
  32.  
  33. procedure TawScriptTest.AddToList(const Msg: WideString);
  34. begin
  35.     Form1.ListBox1.Items.Add(Msg);
  36. end;
  37.  
  38. initialization
  39.   TAutoObjectFactory.Create(ComServer, TawScriptTest, Class_awScriptTest,
  40.     ciMultiInstance, tmApartment);
  41. end.
  42.