Autor Beitrag
Danny W.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 11.01.07 17:23 
Hi Gemeinde :)

ich habe für die Arbeit ein gaaanz simpel gestriktes progrämmchen geschrieben, welches entweder eine IP permanent anpingt oder mehrere nacheinander durchgeht. Ein Memo zeigt dabei die Ergebnisse.

WICHTIG: Im Multiping die IP's einfach !untereinander! schreiben, ohne trennzeichzen usw.

Vielleicht könnt ihr es ja gebrauchen.

LG,
Danny
Einloggen, um Attachments anzusehen!
_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"


Zuletzt bearbeitet von Danny W. am Fr 12.01.07 12:57, insgesamt 2-mal bearbeitet
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Do 11.01.07 18:11 
AAAAAAAHHHHHH, ich find dein programm gar nicht gut :?
ich hab grad keine ip eingegeben und auf "Dauerping starten" gedrückt. jetzt bin ich bei 105 ping.exe, weil ich mit dem beenden nicht nachkomme und der computer ist abgestürzt. da muss du noch was machen!

Ach ja, und in der LogListe steht gar nichts drin
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Fr 12.01.07 10:47 
Die überprüfung habe ich garnicht erst gemacht.. hups :P Naja es steht was drinne wenn man eine IP angibt ^^

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Fr 12.01.07 10:55 
Bei mir kommen auch lauter Kopien - sogar bei einer richtigen IP. :evil:

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Fr 12.01.07 10:55 
Also ich habs nochmal geprüft. Wenn ich nichts eingebe, passiert auch nichts. aber zu einem Absturz führt es nicht.

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Fr 12.01.07 10:56 
vielleicht liegt es daran das ich es mit Win2000 kompiliert hab. Ich mach das zuhause nochmal mit XP.

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Fr 12.01.07 10:59 
*lol* Was hat das den damit zu tun? Kannste mal den Quellcode geben, würd mich mal interessieren. ;)

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Fr 12.01.07 11:02 
danny!

I KILL YOU..aber nur virtuell..wohnst zu weit weg :)

Ich hab Win98..dacht mir ich teste das mal..
klick auf starten...

ausblenden Delphi-Quelltext
1:
2:
3:
 REPEAT
  öffeneNeuesFenster
 UNTIL StefanSchnauzeVollUndNeustart;


Ich hab jetzt 10 Minuten damit verbracht alle Fenster zu schließen :(

Also..ähm tjoa..Ergebnis hab ich auch keins gesehen =)

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Fr 12.01.07 11:21 
hmm..wieso hab ich damit keine Probleme? ^^

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Fr 12.01.07 11:28 
user profile iconMantis1987 hat folgendes geschrieben:
hmm..wieso hab ich damit keine Probleme? ^^


Weil du es programmiert hast, Entwickler haben _NIE_ Probleme mit dr eigenen Software. :mrgreen: Was ist mit dem QC? ;)

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Fr 12.01.07 11:33 
Der Quellcode is aber häßlich ^^ Ich hab ein verstecktes memo um die abfragen zu prüfen.
Ich hatte dieses erst genommen weil ich den aktuellen ping anzeigen lassen wollte, später aber nichtmehr, deswegen habe ich es versteckt und ich war daraufhin zu faul auf eine Stringliste zurückzugreifen.




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:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Unit1, XPMan;

type
  TForm3 = class(TForm)
    Memo1: TMemo;
    Timer1: TTimer;
    Memo2: TMemo;
    Edit1: TEdit;
    Timer2: TTimer;
    Panel1: TPanel;
    Memo3: TMemo;
    Panel2: TPanel;
    Panel3: TPanel;
    XPManifest1: TXPManifest;
    procedure Panel3Click(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Panel2Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Panel1Click(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form3: TForm3;
  sl,hf : Tstrings;

implementation

{$R *.dfm}

procedure RunConsoleApp(const CommandLine: string; AStrings: TStrings);
type
  TCharBuffer = array[0..MaxInt - 1of Char;
const
  MaxBufSize = 1024;
var
  I: Longword;
  SI: TStartupInfo;
  PI: TProcessInformation;
  SA: PSecurityAttributes;
  SD: PSECURITY_DESCRIPTOR;
  NewStdIn: THandle;
  NewStdOut: THandle;
  ReadStdOut: THandle;
  WriteStdIn: THandle;
  Buffer: ^TCharBuffer;
  BufferSize: Cardinal;
  Last: WideString;
  Str: WideString;
  ExitCode: DWORD;
  Bread: DWORD;
  Avail: DWORD;
begin
  GetMem(SA, SizeOf(TSecurityAttributes));
  case Win32Platform of
    VER_PLATFORM_WIN32_NT:
      begin
        GetMem(SD, SizeOf(SECURITY_DESCRIPTOR));
        SysUtils.Win32Check(InitializeSecurityDescriptor(SD, SECURITY_DESCRIPTOR_REVISION));
        SysUtils.Win32Check(SetSecurityDescriptorDacl(SD, True, nil, False));
        SA.lpSecurityDescriptor := SD;
      end{end VER_PLATFORM_WIN32_NT}
  else
    SA.lpSecurityDescriptor := nil;
  end{end case}
  SA.nLength := SizeOf(SECURITY_ATTRIBUTES);
  SA.bInheritHandle := True;
  SysUtils.Win32Check(CreatePipe(NewStdIn, WriteStdIn, SA, 0));
  if not CreatePipe(ReadStdOut, NewStdOut, SA, 0then
  begin
    CloseHandle(NewStdIn);
    CloseHandle(WriteStdIn);
    SysUtils.RaiseLastWin32Error;
  end{end if}
  GetStartupInfo(SI);
  SI.dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
  SI.wShowWindow := {SW_SHOWNORMAL} SW_HIDE;
  SI.hStdOutput := NewStdOut;
  SI.hStdError := NewStdOut;
  SI.hStdInput := NewStdIn;
  if not CreateProcess(nil, PChar(CommandLine), nilnil, True,
    CREATE_NEW_CONSOLE, nilnil, SI, PI) then
  begin
    CloseHandle(NewStdIn);
    CloseHandle(NewStdOut);
    CloseHandle(ReadStdOut);
    CloseHandle(WriteStdIn);
    SysUtils.RaiseLastWin32Error;
  end{end if}
  Last := '';
  BufferSize := MaxBufSize;
  Buffer := AllocMem(BufferSize);
  try
    repeat
      SysUtils.Win32Check(GetExitCodeProcess(PI.hProcess, ExitCode));
      PeekNamedPipe(ReadStdOut, Buffer, BufferSize, @Bread, @Avail, nil);
      if (Bread <> 0then
      begin
        if (BufferSize < Avail) then
        begin
          BufferSize := Avail;
          ReallocMem(Buffer, BufferSize);
        end{end if}
        FillChar(Buffer^, BufferSize, #0);
        ReadFile(ReadStdOut, Buffer^, BufferSize, Bread, nil);
        Str := Last;
        I := 0;
        while (I < Bread) do
        begin
          case Buffer^[I] of
            #0: inc(I);
            #10:
              begin
                inc(I);
                AStrings.Add(Str);
                Str := '';
              end{end #10}
            #13:
              begin
                inc(I);
                if (I < Bread) and (Buffer^[I] = #10then
                  inc(I);
                AStrings.Add(Str);
                Str := '';
              end{end #13}
          else
            begin
              Str := Str + Buffer^[I];
              inc(I);
            end{end else}
          end{end case}
        end{end while}
        Last := Str;
      end{end if}
      Sleep(1);
      Application.ProcessMessages;
    until (ExitCode <> STILL_ACTIVE);
    if Last <> '' then
      AStrings.Add(Last);
  finally
    FreeMem(Buffer);
  end{end try/finally}
  CloseHandle(PI.hThread);
  CloseHandle(PI.hProcess);
  CloseHandle(NewStdIn);
  CloseHandle(NewStdOut);
  CloseHandle(ReadStdOut);
  CloseHandle(WriteStdIn);
end{end procedure}

procedure TForm3.Timer1Timer(Sender: TObject);
begin
memo1.clear;
RunConsoleApp('ping '+edit1.text+' -n 1', Memo1.Lines);
timer2.Enabled:=true;
end;

procedure TForm3.Timer2Timer(Sender: TObject);
begin
  if pos('Antwort von ',memo1.text) <> 0 then begin
    memo2.Clear;
    memo2.Lines.add(Edit1.text+' war zuletzt erreichbar am '+datetostr(date)+' um '+timetostr(time));
    end;
  timer2.Enabled:=false;
end;

procedure TForm3.Panel1Click(Sender: TObject);
begin
if timer1.Enabled then
timer1.Enabled:=false else timer1.Enabled:=true;

if panel1.Caption='Start' then panel1.Caption:='Stop' else panel1.Caption:='Start';
end;

procedure TForm3.FormShow(Sender: TObject);
begin
edit1.setfocus;
end;

procedure TForm3.Panel2Click(Sender: TObject);
var i : integer;
begin
warten.visible:=true;
sl := Tstringlist.create;
sl.text := memo3.text;
hf := Tstringlist.create;

memo1.clear;

  for i := 0 to sl.count-1 do begin
  RunConsoleApp('ping '+sl.strings[i]+' -n 1', Memo1.Lines);
    if pos('Antwort von ',memo1.text) <> 0 then begin
    memo2.Lines.add(sl.strings[i]+' war zuletzt erreichbar am '+datetostr(date)+' um '+timetostr(time));
    memo1.clear;
    end;

  end;
 hf.text := memo2.text;
 warten.visible:=false;;
 showmessage('Aktive Clients: '+inttostr(hf.count));
 memo1.clear;
end;

procedure TForm3.FormDestroy(Sender: TObject);
begin
sl.free;
hf.free;
end;

procedure TForm3.Panel3Click(Sender: TObject);
begin
Memo2.clear;
end;

end.


Und das Lade-Formular
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:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ComCtrls, Gauges, XPMan;

type
  Twarten = class(TForm)
    Panel2: TPanel;
    Timer1: TTimer;
    Gauge1: TGauge;
    XPManifest1: TXPManifest;
    procedure FormHide(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  warten: Twarten;

implementation

{$R *.dfm}

procedure Twarten.Timer1Timer(Sender: TObject);
begin
Gauge1.Progress:=Gauge1.Progress+2;

  if (gauge1.progress >= 100and (Gauge1.Forecolor = clSilver) then begin
    Gauge1.Forecolor := clWhite;
    Gauge1.Backcolor := clSilver;
    Gauge1.Progress:=0;
    end;

  if (gauge1.progress >= 100and (Gauge1.Forecolor = clWhite) then begin
    Gauge1.Forecolor := clSilver;
    Gauge1.Backcolor := clWhite;
    Gauge1.Progress:=0;
    end;



end;

procedure Twarten.FormShow(Sender: TObject);
begin
timer1.enabled := true;
doublebuffered := true;
end;

procedure Twarten.FormHide(Sender: TObject);
begin
timer1.enabled := false;
end;

end.


mfG,
Danny

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Fr 12.01.07 12:01 
(1) ich habe Window's beenden müssen, weil nur noch neue Fenster kamen, trotz richtiger IP
:?
(2) start überarbeitunswürdiges Programm
:?

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Fr 12.01.07 12:06 
hmm ^^ bei euch stürzen überall die Computer ab :)

Bin ich der einzige bei dem es richtig läuft?! Ich teste es mal eben beim kollegen der is eh grad in der kantine...

mfG,
Danny

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"


Zuletzt bearbeitet von Danny W. am Fr 12.01.07 12:32, insgesamt 1-mal bearbeitet
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Fr 12.01.07 12:10 
user profile iconMantis1987 hat folgendes geschrieben:
hmm ^^ bei euch stürzen überall die Computer ab :)

Bin ich der einzige bei dem es richtig läuft?! Es teste es mal eben beim kollegen der is eh grad in der kantine...

mfG,
Danny


Der wird sich freuen. :lol: Hab leider keine Zeit dein Programm zu testen, muss andere Bugs jagen. :?

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Fr 12.01.07 12:25 
Ist doch ganz klar warum. Ihr müsst die EXE erst umbennen. Sonst ruft sein Programm nicht ping.exe von Windows auf, sondern sich selbst (weil es auch ping.exe heißt).
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Fr 12.01.07 12:32 
hey oh wunder..es geht...

hmm...immer wenn ich auf start klick um zu stoppen steht stop da..klick ich dann auf stop startet er wieder...

führe ich multiping durch, macht er zwar richtig, allerdings summiert er das in der anzeige/ausgabe immer auf und gibt dann immer an beim 1. mal 3 beim 2. mal 6 beim 3. mal 9..

Joa ich schaus mir daheim mal an

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Fr 12.01.07 12:33 
HA! Da ist der Fehler :) Da hätte ich aber auch erstmal drauf kommen müssen :)

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10181
Erhaltene Danke: 1254

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 12.01.07 12:34 
Moin!

Wie wäre es denn, auf die ICMP-API von Windows zurückzugreifen, statt (sinnlos) Konsolenanwendungen zu starten und dann Probleme mit den EXE-Namen zu bekommen... :nut: ;)

Delphi-Wrapper gibt´s doch genug. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Fr 12.01.07 12:39 
wäre eigentlich einfacher :/ dann bräuchte ich diese elendig lange funktion auch nicht ^^

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Fr 12.01.07 12:42 
user profile iconZeitGeist87 hat folgendes geschrieben:
...allerdings summiert er das in der anzeige/ausgabe immer auf und gibt dann immer an beim 1. mal 3 beim 2. mal 6 beim 3. mal 9..


Kann doch eigentlich garnicht sein. Was du rechts ins Memo schreibt wird gleichzeitig in eine Stringliste geschrieben. Davon gebe ich nur den Count aus, dieser wird bei mir auch richtig dargestellt

user defined image

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"