Koenntest du vielleicht wie vorgeschlagen deine Funktion entmisten?
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
err, getNum : KMErrorCode;
NumDevices : Word;
c : Integer;
name :
array [0..MAX_TCP_NM_LENGTH]
of PChar;
ip:
array [0..MAX_TCP_IP_LENGTH]
of PChar;
ser:
array [0..MAX_TCP_SN_LENGTH]
of PChar;
dip:
array [0..MAX_TCP_SN_LENGTH]
of Word;
begin
err := KMInitialize;
Memo1.Lines.Append('
Wait....');
NumDevices := 0;
KMTCPRefreshDevices();
getNum := KMTCPGetNumDevices(NumDevices);
if getNum = 0
then
err := KMTCPGetDeviceInformation(@
name[0], @
ip[0], @ser[0], dip[0], NumDevices);
if err = 0
then
begin
memo1.Lines.Append('
Controllers Found ' + IntToStr(NumDevices));
for I := 0
to NumDevices - 1
do
begin
Memo1.Lines.Append('
Name : ' +
name[I]);
Memo1.Lines.Append('
Ip-Addr : ' +
ip[I]);
Memo1.Lines.Append('
Serial : ' + ser[I]);
Memo1.Lines.Append('
Dip Settings : ' + IntToStr(dip[I]));
Memo1.Lines.Append(StringOfChar('
-', 60));
end;
end;
Memo1.Lines.Append('
finished');
end;