home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 March / Chip_1999-03_cd.bin / zkuste / delphi / INFO / DI9807BL.ZIP / Intf / Server / ChatServer_TLB.pas < prev    next >
Pascal/Delphi Source File  |  1998-05-08  |  4KB  |  123 lines

  1. unit ChatServer_TLB;
  2.  
  3. { This file contains pascal declarations imported from a type library.
  4.   This file will be written during each import or refresh of the type
  5.   library editor.  Changes to this file will be discarded during the
  6.   refresh process. }
  7.  
  8. { ChatServer Library }
  9. { Version 1.0 }
  10.  
  11. interface
  12.  
  13. uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL;
  14.  
  15. const
  16.   LIBID_ChatServer: TGUID = '{624DDEA1-70F1-11D1-B877-0000B4552A26}';
  17.  
  18. const
  19.  
  20. { Component class GUIDs }
  21.   Class_ChatConnection: TGUID = '{624DDEA3-70F1-11D1-B877-0000B4552A26}';
  22.   Class_ChatChannel: TGUID = '{8FDCD6B6-742C-11D1-B87E-0000B4552A26}';
  23.  
  24. type
  25.  
  26. { Forward declarations: Interfaces }
  27.   IChatConnection = interface;
  28.   IChatConnectionDisp = dispinterface;
  29.   IChatChannel = interface;
  30.   IChatChannelDisp = dispinterface;
  31.   IChatEvent = interface;
  32.   IChatEventDisp = dispinterface;
  33.  
  34. { Forward declarations: CoClasses }
  35.   ChatConnection = IChatConnection;
  36.   ChatChannel = IChatChannel;
  37.  
  38.   IChatConnection = interface(IDispatch)
  39.     ['{624DDEA2-70F1-11D1-B877-0000B4552A26}']
  40.     function Get_ChatChannel: IChatChannel; safecall;
  41.     procedure BroadcastMessage(const UserName, Message: WideString); safecall;
  42.     property ChatChannel: IChatChannel read Get_ChatChannel;
  43.   end;
  44.  
  45. { DispInterface declaration for Dual Interface IChatConnection }
  46.  
  47.   IChatConnectionDisp = dispinterface
  48.     ['{624DDEA2-70F1-11D1-B877-0000B4552A26}']
  49.     property ChatChannel: IChatChannel readonly dispid 1;
  50.     procedure BroadcastMessage(const UserName, Message: WideString); dispid 2;
  51.   end;
  52.  
  53.   IChatChannel = interface(IDispatch)
  54.     ['{ADF8F1E0-72A0-11D1-B87B-0000B4552A26}']
  55.     function ConnectUser(const Callback: IChatEvent; var UserId: Integer): WordBool; safecall;
  56.     function DisconnectUser(UserId: Integer): WordBool; safecall;
  57.     procedure BroadcastMessage(const UserName, Message: WideString); safecall;
  58.   end;
  59.  
  60. { DispInterface declaration for Dual Interface IChatChannel }
  61.  
  62.   IChatChannelDisp = dispinterface
  63.     ['{ADF8F1E0-72A0-11D1-B87B-0000B4552A26}']
  64.     function ConnectUser(const Callback: IChatEvent; var UserId: Integer): WordBool; dispid 1;
  65.     function DisconnectUser(UserId: Integer): WordBool; dispid 2;
  66.     procedure BroadcastMessage(const UserName, Message: WideString); dispid 3;
  67.   end;
  68.  
  69.   IChatEvent = interface(IDispatch)
  70.     ['{2A611DD1-743E-11D1-B87F-0000B4552A26}']
  71.     procedure GotMessage(const UserName, Message: WideString); safecall;
  72.   end;
  73.  
  74. { DispInterface declaration for Dual Interface IChatEvent }
  75.  
  76.   IChatEventDisp = dispinterface
  77.     ['{2A611DD1-743E-11D1-B87F-0000B4552A26}']
  78.     procedure GotMessage(const UserName, Message: WideString); dispid 1;
  79.   end;
  80.  
  81. { ChatConnection }
  82.  
  83.   CoChatConnection = class
  84.     class function Create: IChatConnection;
  85.     class function CreateRemote(const MachineName: string): IChatConnection;
  86.   end;
  87.  
  88. { ChatChannel }
  89.  
  90.   CoChatChannel = class
  91.     class function Create: IChatChannel;
  92.     class function CreateRemote(const MachineName: string): IChatChannel;
  93.   end;
  94.  
  95.  
  96.  
  97. implementation
  98.  
  99. uses ComObj;
  100.  
  101. class function CoChatConnection.Create: IChatConnection;
  102. begin
  103.   Result := CreateComObject(Class_ChatConnection) as IChatConnection;
  104. end;
  105.  
  106. class function CoChatConnection.CreateRemote(const MachineName: string): IChatConnection;
  107. begin
  108.   Result := CreateRemoteComObject(MachineName, Class_ChatConnection) as IChatConnection;
  109. end;
  110.  
  111. class function CoChatChannel.Create: IChatChannel;
  112. begin
  113.   Result := CreateComObject(Class_ChatChannel) as IChatChannel;
  114. end;
  115.  
  116. class function CoChatChannel.CreateRemote(const MachineName: string): IChatChannel;
  117. begin
  118.   Result := CreateRemoteComObject(MachineName, Class_ChatChannel) as IChatChannel;
  119. end;
  120.  
  121.  
  122. end.
  123.