上一页 1 ··· 164 165 166 167 168 169 170 171 172 ··· 203 下一页
摘要: Tlist (Classes.pas)在我刚开始接触TList的时候,TList搞得我迷雾重重,都是Capacity属性惹的祸。我查了Delphi的帮助,它说Capacity是TList的最大容量,又在什么地方说MaxIntdiv 4是TList的最大容量。最后我搞明白了,Capacity是临时的,MaxInt div 4才是真正的最大容量。只要你的内存受得了就行,算起来一共是4G。在TList 内部有一个FList指针指向一个Pointer数组,Capacity就是这个数组的大小。奇怪的是Capacity是可写的。我当时就在想,如果一直使用Add 直到超出了Capacity的范围,会怎么样呢 阅读全文
posted @ 2010-10-30 21:24 delphi中间件 阅读(440) 评论(0) 推荐(0)
摘要: TstringList (Classes.pas)在TstringList里,那些String被一行一行地储存。TstringList.Text返回全部的String。如果第一、二、三行分别是/'aa/'、/'bb/'、/'cc/' 的话,那么Text 返回的是“/'aa/'+#13#10+/'bb/'+#13#10+/'cc/'+#13#10” (不包括双引号)。所有的String都被TstringList用回车和换行符(#13#10)连接了起来。如果依次向Text赋值的话,Text就会被自动地分 阅读全文
posted @ 2010-10-30 21:19 delphi中间件 阅读(563) 评论(0) 推荐(0)
摘要: 1.首先放置TApplicationEvents控件。2.procedure TF_Main.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);begin case Msg.Message of WM_USER + 128: Begin case Msg.wParam of 1: F_Main. Button129Click(F_Main.Button129); 2: XXXXX; end; end;End;3.发送消息调用PostMessage(Application.Handle, WM_USER + 128. 阅读全文
posted @ 2010-09-20 14:59 delphi中间件 阅读(205) 评论(0) 推荐(0)
摘要: TMsg02 = packed record case _DT: Byte of $01: (_Msg0201: TMsg0201); $02: (_Msg0202: TMsg0202); $03: (_Msg0203: TMsg0203); $04: (_Msg0204: TMsg0204); $05: (_Msg0205: TMsg0205); $06: (_Msg0206: TMsg0206); $07: (_Msg0207: TMsg0207); $08: (_Msg0208: TMsg0208); end;Char($02): case Dt of Char($01): Result 阅读全文
posted @ 2010-09-18 02:13 delphi中间件 阅读(218) 评论(0) 推荐(0)
摘要: uses Zlib;//压缩函数procedure Zip(var fs: TMemoryStream);var cs: TCompressionStream; ms: TMemoryStream; num: Integer;begin if not(Assigned(fs) and (fs.Size>0)) then Exit; num := fs.Size; ms := TMemoryStream.Create; cs := TCompressionStream.Create(clMax, ms); try fs.SaveToStream(cs); cs.Free; //ms.Pos 阅读全文
posted @ 2010-09-18 01:47 delphi中间件 阅读(200) 评论(0) 推荐(0)
摘要: //用字符指针读取流中的内容 var pc: PChar; begin pc := mStream.Memory;{把字符指针指向内存流} ShowMeage(pc[0]);//从流读入到缓冲区 var buffer: array[0..2] of Char;{定义个字符缓冲区}begin mStream.Seek(0, soFromBegiing); mStream.Read(buffer, SizeOf(buffer)); ShowMeage(buffer);{关于 Seek 函数: 参数1: Offset 是偏移量; 参数2: Origin 是指针的基准位置, 有三个选值... 阅读全文
posted @ 2010-09-18 01:43 delphi中间件 阅读(235) 评论(0) 推荐(0)
摘要: 发送try s := 'Hello world!'; stream := TStringStream.Create(s); IdTCPClient1.OpenWriteBuffer; IdTCPClient1.WriteInteger(stream.Size);//注意这里:要先写入流的长度,在读取的时候如果使用 AThread.Connection.ReadStream(stream); IdTCPClient1.WriteStream(stream, true); finally IdTCPClient1.CloseWriteBuffer; st... 阅读全文
posted @ 2010-09-18 01:32 delphi中间件 阅读(329) 评论(0) 推荐(0)
摘要: unit Unit1; interface uses Windows, Meages, SysUtils, Variants, Claes, Graphics, Controls, Forms, Dialogs, StdCtrl type TForm1 = cla(TForm) Memo1: TMemo;{添加 Memo 显示内容}Button1: TButto Button2: TButto procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private {Pri... 阅读全文
posted @ 2010-09-18 01:19 delphi中间件 阅读(267) 评论(0) 推荐(0)
摘要: Type TRecord = Record Name: String[10]; address: String[50]; End; TRecordFile = File Of TRecord;Var Form1: TForm1; aRecordFile: TRecordFile; aRecordFileName: String = 'c:PersonS.dat';Implementation{$R *.dfm}Function RecordsSaveToFile(aFileName: String; aRecord: TRecord): Boolean;Begin R... 阅读全文
posted @ 2010-09-18 01:11 delphi中间件 阅读(794) 评论(0) 推荐(1)
摘要: 1.服务器端: type TMSG001 = Packed Record //定义记录类型 userId: array[0..19] of char; password: array[0..17] of char; end;PSendMSG=^TMSG001;//定义指针类型var pSend: PSendMSG;//定义指针pSend^.userId := '001';//生成要发送数据pSend^.password := '001';_SocketS.Socket.Connections[i].SendBuf(pSend^, sizeof(TMSG001)) 阅读全文
posted @ 2010-09-18 00:53 delphi中间件 阅读(252) 评论(0) 推荐(0)
上一页 1 ··· 164 165 166 167 168 169 170 171 172 ··· 203 下一页