Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Do 08.12.05 20:40 
Unzwar haben mir Narses und Muetze1 wertvolle Hinweise zum Schreiben des eigenen einfachen(!) Netzwerkprotokolls gegeben. ALso hier nun mein Versuch:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
var
  Form1: TForm1;
  command : string;

implementation

{$R *.dfm}

function ChangeCommandString(commandstring : string) : string;
var anfang,ende : integer;
begin
showmessage('Commandstring:   '+commandstring);
anfang:=pos('<',commandstring);
showmessage('Anfang:     '+inttostr(anfang));
ende:=pos('>',commandstring);
showmessage('Ende: '+inttostr(ende));
result:=copy(commandstring,anfang+1,ende-anfang-1);
showmessage('result: '+result);
delete(commandstring,1,anfang);
showmessage('Commandstring nach Bearbeitung: '+commandstring);
end;



procedure TForm1.ClientSocket1Read(Sender: TObject;
  Socket: TCustomWinSocket);
begin
command:=command+socket.receivetext;
memo1.lines.add(ChangeCommandString(command));
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
//showmessage('<getmouse#'+inttostr(mouse.cursorpos.x)+'#'+inttostr(mouse.CursorPos.Y));
serversocket1.socket.Connections[0].SendText('<getmouse#'+inttostr(mouse.cursorpos.x)+'#'+inttostr(mouse.CursorPos.Y)+'>');
timer1.enabled:=false;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.enabled:=true;
end;

procedure TForm1.FormClick(Sender: TObject);
begin
showmessage('Auf Form geklickt');
serversocket1.socket.connections[0].SendText('<click#left>');
end;


Das arbeitet aber nicht so wie ich mir das vorstell. Das fängt schon bei der 'delete' Funktion an

ausblenden Delphi-Quelltext
1:
delete(commandstring,1,anfang);					

Es soll halt vom 'commandstring' vom Anfang des Strings bis hin zu dem Index der in 'anfang' enthalten ist abgeschnitten werden. Aber das wird nicht getan, den in der listbox kommt immer dieselbse Mausposition (ach ja, ich bewege die Maus auch :wink: )Das heißt es wird der String nicht abgetrennt. Wie muss die Zeile richtig lauten, denn ich glaube sonst funzt alles. :gruebel:

CU KOLLER

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Do 08.12.05 21:41 
Zitat:

command:=command+socket.receivetext;


Hier lag der Fehler. Ich hab das Command hinter = weggenommen und es funktioniert. Sogar bei 1 ms Als Interval wird alles korrekt übertragen. :D

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot