1 {-----------------------------------------------------------------------------
2 Unit Name: Kol_AnonymousServer
3 Author: Thaddy de Koning
4 Purpose: Demo Anonymous Pipe streams from kolipcstreams.pas
5 History: February 17, 2003, Initial release
6 -----------------------------------------------------------------------------}
9 unit Kol_AnonymousServer
;
10 //********************************************************************
11 // Created by KOL project Expert Version 2.00 on:13-2-2003 16:56:56
12 //********************************************************************
17 Windows
, Messages
, Kol
, KolIPCStreams
;
31 function ThreadExecute(sender
:pThread
):integer;
32 procedure BtnClick(sender
:pObj
);
34 procedure WriteString(const S
:string);
39 procedure NewForm1( var Result
: PForm1
; AParent
: PControl
);
46 procedure NewForm1( var Result
: PForm1
; AParent
: PControl
);
51 Form
:= NewForm(AParent
,'KOLForm').SetSize(600,400).centeronparent
.Tabulate
;
53 Form
.Add2AutoFree(Result
);
54 NPS
:=NewAnonymousPipeReadStream('KolAnonimousClient.exe',true);
55 Form
.Add2AutoFree(NPS
);
56 Memo
:=NewEditBox(Form
,[eoMultiline
]);
58 Button
:=NewButton(Form
,'Read').placeright
.resizeparent
;
59 Button
.OnClick
:=btnClick
;
63 procedure Tform1
.BtnClick(sender
:pObj
);
65 Thread
:=NewThreadAutoFree(ThreadExecute
);
69 function Tform1
.ThreadExecute(sender
:pThread
):integer;
74 SetLength(TempStr
,1024);
75 Count
:=NPS
.Read(TempStr
[1],Length(TempStr
));
76 SetLength(TempStr
,Count
);
80 procedure Tform1
.UpdateMemo
;
85 procedure Tform1
.WriteString(const S
:string);
88 Thread
.Synchronize(UpdateMemo
);