(* Collection of code snippets by Arne Vajhøj *)
(* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) *)
program TestPas;

{$mode delphi}{$H+}

uses
  ActiveX, TestLibrary_1_0_TLB;

var
  test, another, temp : ITest;
  test2 : ITest2;

begin
  writeln('COM/Pascal static:');
  CoInitialize(nil);
  test := CoCoTest.Create;
  writeln('123 + 456 = ', test.Add(123, 456));
  writeln('ABC + XYZ = ', test.Concat('ABC', 'XYZ'));
  writeln('IV = ', test.IV, ' SV = ', test.SV); 
  test.IV := 123;
  test.SV := 'ABC';
  writeln('IV = ', test.IV, ' SV = ', test.SV); 
  another := test.Another; (* seems to leak a reference ???? *)
  writeln('Another 123 + 456 = ', another.Add(123, 456));
  temp := CoCoTest.Create;
  temp.QueryInterface(IID_ITest2, test2);
  writeln('Sum = ', test2.Sum(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
  writeln('Sum 1..5 = ', test2.Sum(1, 2, 3, 4, 5, 0, 0, 0, 0, 0));
  writeln('Sum 1..10 = ', test2.Sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
  CoUninitialize;
end.
