com_clnt.dpr 521 B

12345678910111213141516171819202122232425262728
  1. program com_clnt;
  2. // Comtest demo from Anton K. mantis #35013
  3. {$ifdef fpc}{$mode delphi}{$endif}
  4. uses variants,sysutils,classes,activex,comobj;
  5. var co,resp:variant;
  6. begin
  7. co := CreateOleObject('com_serv.TestApp');
  8. if (VarIsEmpty(co)) then halt(1);
  9. try
  10. co.test('Hello1');
  11. resp:=widestring('yyyyy');
  12. co.test_ret(resp);
  13. writeln(resp);
  14. if (resp<>'zzzz') then halt(2);
  15. except
  16. on E:Exception do
  17. begin
  18. writeln(E.Message);
  19. halt(3);
  20. end;
  21. end;
  22. writeln('Success!');
  23. end.