正在阅读:开发基于DCOM的局域网聊天室(一)开发基于DCOM的局域网聊天室(一)

2004-02-14 09:34 出处:CSDN 作者:hkbarton 责任编辑:linjixiong
initialization       TAutoObjectFactory.Create(ComServer, TChatManager, Class_ChatManager,       ciMultiInstance, tmApartment);      end.      比较关键TchatRoom是下面的样子:      type       TChatRoom=class       private       FBuffer:array[1..20] of string;       FBufferLength:integer;       FRoomName:string;    FRoomID:integer;       FLocked:boolean;//同步锁,用来处理多人同时发出对话的情况       FConnectCount:integer;//当前房间的人数       FClearBufferTag:integer;       //每清空一次buffer此值便跳变一次,此脉冲被客户端检测       protected       procedure ClearBuffer;//清空缓冲区       function GetCanRead:boolean;       public       constructor Create(RoomName:string;RoomID:integer);       procedure OneSpeak(content:string);//将一条聊天内容加入缓冲区       procedure LoginRoom(UserName:string);//参看实现部分注释       procedure LeaveRoom(UserName:string);//参看实现部分注释       function OneRead:Tstrings;//从缓冲区中读出记录       property Locked:boolean read FLocked; //readonly;//供IChatManager检测       property CanRead:boolean read GetCanRead;//判断缓冲区是否为空,否则是不可读的       property ClearBufferTag:integer read FClearBufferTag;       end;
察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:
键盘也能翻页,试试“← →”键

关注我们

最新资讯离线随时看 聊天吐槽赢奖品