home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 March / Chip_1999-03_cd.bin / zkuste / delphi / INFO / DI9802TS.ZIP / MyObj.pas < prev    next >
Pascal/Delphi Source File  |  1997-07-23  |  727b  |  32 lines

  1. { This is the implementation of a custom COM Automation Object that we
  2.   will be exposing to the scripting engine }
  3. unit MyObj;
  4.  
  5. interface
  6.  
  7. uses
  8.   ComObj, Demo_TLB, Dialogs, SysUtils;
  9.  
  10. type
  11.   TMyObj = class(TAutoObject, IMyObj)
  12.   protected
  13.     procedure ShowCelcius(DegreesF: Integer); safecall;
  14.   end;
  15.  
  16. implementation
  17.  
  18. uses ComServ;
  19.  
  20. procedure TMyObj.ShowCelcius(DegreesF: Integer);
  21. var
  22.   DegreesC : Integer;
  23. begin
  24.   DegreesC := (DegreesF - 32) * 5 div 9;
  25.   MessageDLG( Format( '%d degrees Fahrenheit is equal to %d degrees Celcius.',
  26.     [DegreesF, DegreesC]) , mtInformation, [mbOK], 0 );
  27. end;
  28.  
  29. Initialization
  30.   TAutoObjectFactory.Create(ComServer, TMyObj, Class_MyObj, ciMultiInstance);
  31. end.
  32.