English
Forum

Ping Tool from CMD

 
- Page 1 -



Penguin
Tux
Hi,

i want me ersteinmal present. my name is Tony, i'm 15 years old and visit a six-year secondary school in Chemnitz. Since I now Sommerferien have what about me nothing moreover To do have, have I me undertaken one small Netzwerkanalysetool To write. on the Search after a einfachen Programming-Language be I on XProfan punched.

I have everything nötige gedownloaded and installs, connect have I to one Pingcode sought and I this:
declare pingstring$,ping$,ping%
********************************************************************

Proc Ping

    Parameters nic$,pingdatei1$,pingdatei2$
    let pingstring$="PING.EXE",nic$,">",pingdatei1$
    Assign #6,pingdatei2$
    Rewrite #6
    Print #6,pingstring$
    Close #6
    WinExecwait(pingdatei2$,0)
    Assign #5,pingdatei2$
    Erase #5
    ASSIGN #3,pingdatei1$
    RESET #3
    Ping%=0

    WHILENOT EOF(#3)

        input #3,ping$
        ping$=mid$(ping$,1,11)
        case equ$(ping$,"Antwort von"):Ping%=1

    WEND

    CLOSE #3
    Assign #1,pingdatei1$
    Erase #1

ENDPROC

********************************************************************
Description:
it gives of course already a speedy and nice Onlineabfrage über API,
but unfortunately gives The function only 1 for Online back, if
one über one Standart DFÜ eingewählt is.
These procedure is hold only something slower but one can even DSL
(means - no DFÜ-link) or the old T-Online u.s.w inquire!!
everything with one star umrandete is important for The request
Rolf cook - Rokosoftware - Koblenz 2002
BEISPIEL
WINDOWSTYLE 31
Window 200,200-300,80
Windowtitle "Onlinstatus-check without Api"
Text Color RGB(0,0,255),-1
UseFont "TIMES NEW ROMAN",20,10,0,0,0
DRAWTEXT 40,10,"..momentum ermittele!"
HIER JETZT THE AUFRUF THE PROZEDUR:********************
PING ADRESSE,ERGEBNISDATEI,BATCHDATEI
Parameter
1.) Webadresse - a always available How www.nic.de
2.) Dateiname, in which Pingergebnis written becomes - becomes again deleted!
3.) Dateiname, circa Ping correctly aufzurufen. - becomes again deleted!
********************************************************
Text Color RGB(255,255,255),RGB(255,255,255)
DRAWTEXT 40,10,"                                "
UseFont "TIMES NEW ROMAN",25,20,1,0,0
Text Color RGB(0,0,255),-1
Ping "192.168.0.7","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    DRAWTEXT 25,10,"Erreichbar"

else

    DRAWTEXT 25,10,"Nicht erreichbar"

endif

waitinput

Diesen code have I me to my Bedürfnissen zurechtgeschnitten and it sees How follows from. moreover should I The of me ausgedachte Funktionsweise explain.

its planned, I one Tool write, which possible simply a first Help for schoolboy and teacher bid. notice one User the it none Internetzugang has, lead it the Tool from, which the row to first whom Server anpingt, then a others Client the network and then yet a computer of outside (z.B. Date). If it with of/ one the steps no feedback gives, should a Message with hints to removal on the Bildschrim attend.

now to that code:
declare pingstring$,ping$,ping%

Proc Ping

    Parameters nic$,pingdatei1$,pingdatei2$
    let pingstring$="PING.EXE",nic$,">",pingdatei1$
    Assign #6,pingdatei2$
    Rewrite #6
    Print #6,pingstring$
    Close #6
    WinExecwait(pingdatei2$,0)
    Assign #5,pingdatei2$
    Erase #5
    ASSIGN #3,pingdatei1$
    RESET #3
    Ping%=0

    WHILENOT EOF(#3)

        input #3,ping$
        ping$=mid$(ping$,1,11)
        case equ$(ping$,"Antwort von"):Ping%=1

    WEND

    CLOSE #3
    Assign #1,pingdatei1$
    Erase #1

ENDPROC

WINDOWSTYLE 31
Window 200,200-500,80
Windowtitle "Onlinstatus-check without Api"
Text Color RGB(0,0,255),-1
UseFont "TIMES NEW ROMAN",20,10,0,0,0
DRAWTEXT 40,10,"..momentum ermittele!"
Text Color RGB(255,255,255),RGB(255,255,255)
DRAWTEXT 40,10,"                                "
UseFont "CANDARA",25,20,1,0,0
Ping "127.0.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    Text Color RGB(0,255,0),-1
    DRAWTEXT 25,10,"Server Erreichbar"

else

    Text Color RGB(255,0,0),-1
    DRAWTEXT 25,10,"Server not erreichbar"

endif

Ping "192.168.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    Text Color RGB(0,255,0),-1
    DRAWTEXT 25,10,"Client Erreichbar"

else

    Text Color RGB(255,0,0),-1
    DRAWTEXT 25,10,"Client not erreichbar"

endif

Ping "www.google.de","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    Text Color RGB(0,255,0),-1
    DRAWTEXT 25,10,"Google Erreichbar"

else

    Text Color RGB(255,0,0),-1
    DRAWTEXT 25,10,"Google not erreichbar"

endif

waitinput

One trouble, which itself to Time auftut, is the fact the the Fensterinhalt not gelöcht becomes. that is the "Server Erreichbar", "Client Erreichbar" and "Google Erreichbar" übereinander written go, means need I a Possibility whom Content the Fensters to each step To delete. thereby be on

punched. Nutze I these Possibility to or. to "Server Erreichbar" becomes "Server Erreichbar" none displayed.

for a small Hilfestellung would I very grateful.

thanks
Tony
 


OS: Win XP/Debian
XProfan 10
07/20/08  
 



 
- Page 6 -



Penguin
Tux

CompileMarkSeparation
use I Yes not any more, but if must it still
CompileMarkSeparation
hot?
 


OS: Win XP/Debian
XProfan 10
07/21/08  
 




Rolf
Koch
Tony? What exactly want You destroy?
very whom dialog!
If you say:
DLG&=Create("DIALOG".... , then save windows the lever in DLG&
these a eindeutige number How 127222 or so, which Windows give away becomes.
two Listviews means with you destroy go? 1 or 0?
No! it to the dialog destroy go. means:
How I supra already written have: DESTROYWINDOW(DLG&)
just as behave it itself with SHOWWINDOW
SHOWWINDOW(BUTTON1&,0) cache one Objekt
SHOWWINDOW(BUTTON1&,1) bring it again to that Vorschein.
But if You DLG& by Destroywindow again destroy have, then can You it naturally not any more with SHOWWINDOW Show, there it the lever not any more gives. means then again new create and think about in Your drop again
DIALOGENDE%=0 To settle, so The Loop not again directly terminates.
You can but instead of DESTROYWINDOW really
SHOWWINDOW(DLG&,0) to the Dialogerstellen settle circa it To hide and if Click on Helpbutton the Hilfefenster by SHOWWINDOW(DLG&,1) again Show. After Click on HILFE SCHLIESSEN simply again SHOWWINDOW(DLG&,0) and already becomes it again cache.

P.s.: iF has right, read you Please very each set in the Help through, because You benötigst no DEF....
neckline Help SHOWWINDOW:


n1 : LongInt - Window-lever

n2 : Integer - Abbildungsmodus (1 .. 9)

the Window with the lever n1 becomes in the mode n2 displayed. the Result is 1 if the window before visible was or 0, if it before cache (invisible) was.


under stehender Text is only to Statement the suitable API, which You in your Profanversion not benötigst.
 
07/21/08  
 




Penguin
Tux
I come straight Real not afterwards

means, my code for the Program self sees now so from:
CompileMarkSeparation
declare pingstring$, ping$, ping%

Proc Ping

    Parameters nic$,pingdatei1$,pingdatei2$
    let pingstring$="PING.EXE",nic$,">",pingdatei1$
    Assign #6,pingdatei2$
    Rewrite #6
    Print #6,pingstring$
    Close #6
    WinExecwait(pingdatei2$,0)
    Assign #5,pingdatei2$
    Erase #5
    ASSIGN #3,pingdatei1$
    RESET #3
    Ping%=0

    WHILENOT EOF(#3)

        input #3,ping$
        ping$=mid$(ping$,1,11)
        case equ$(ping$,"Antwort von"):Ping%=1

    WEND

    CLOSE #3
    Assign #1,pingdatei1$
    Erase #1

EndProc

WINDOWSTYLE 31
Window 200,200-500,180
Windowtitle "PiRePro by penguin"
TextColor RGB(0,0,255),-1
UseFont "TIMES NEW ROMAN",20,10,0,0,0
DRAWTEXT 40,10,"..moment ermittele!"
TextColor RGB(255,255,255),RGB(255,255,255)
DRAWTEXT 40,10,"                                "
UseFont "CANDARA",25,20,1,0,0
Ping "127.0.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,10,"Server Erreichbar"

else

    TextColor RGB(255,0,0),-1
    DRAWTEXT 25,10,"Server Nicht erreichbar"

endif

Hier Code für Fehlermeldung/Tipbox
Ping "192.168.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,40,"Client Erreichbar"

else

    TextColor RGB(255,0,0),-1
    DRAWTEXT 25,40,"Client Nicht erreichbar"

endif

Hier Code für Fehlermeldung/Tipbox
Ping "www.google.y","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,70,"Extern Erreichbar"

else

    TextColor RGB(255,0,0),-1
    DRAWTEXT 25,70,"Extern Nicht erreichbar"

endif

Hier Code für Fehlermeldung/Tipbox
Hier Code für Meldung des Erfolgs
TextColor RGB(0,0,0),-1
UseFont "CANDARA",15,10,1,0,0
DRAWTEXT 25,120,"Zum Beenden drücken Sie bitte eine beliebige Taste&quo
on> waitinput

...and the for the Window:
CompileMarkSeparation
>>>>> AB HIER KOPIEREN UND IN EIGENEN CODE EINBINDEN <<<<<<<<<<<<
DEF GETSYSCOLOR(1) !"USER32","GetSysColor"
SET("TRUECOLOR",1)
 $I C:DOKUMENTE UND EINSTELLUNGENTONYDESKTOPROCLIBUSER.INC (for WIN32 OBJEKTE)

PROC DIALOG  ---------------------------------------------------------------------------> Dialoganfang

    DECLARE DLG&, DIALOGENDE%
    DECLARE TEXT1&
    DECLARE BUTTON1&

    PROC BUTTON1_ONCLICK

        GETMESSAGE
        DIALOGENDE%=1

    ENDPROC

    DLG&=CREATE("DIALOG",%HWND,"Neues Fenster",236,32,640,500)
    USEFONT "MS Sans Serif",13,0,0,0,0
    SETDIALOGFONT 1
    TEXT1& =@CREATE("TEXT",DLG&,"...Hilfetext...",0204,0101,0070,0020)

    PROC DLG_REFRESH

        SET("AUTOPAINT",1)
        STARTPAINT DLG&
        DRAWFRAME 0130,0080,0200,0120,2,15
        ENDPAINT

    ENDPROC

    BUTTON1& =@CREATE("BUTTON",DLG&,"OK",0200,0133,0070,0030)
    SETFOCUS(DLG&)
    DLG_REFRESH
    DIALOGENDE%=0

    WHILENOT DIALOGENDE%

        WAITINPUT

        If %KEY=2

            DIALOGENDE%= 1

        ELSEIF %WMPAINT

            DLG_REFRESH

        ELSEIF GETFOCUS(BUTTON1&) BUTTON

            BUTTON1_ONCLICK

        ENDIF

    ENDWHILE

    DESTROYWINDOW(DLG&)
    ENDPROC --------------------------------------------------------------------------------> Dialogende
    SET("AUTOPAINT",2)
    >>>>> HIER KOPIERENDE FOR EIGENEN CODEEINBAU <<<<<<<<<<<<<<<<<<<<

means must I weder 1 yet 0 destroy.
 


OS: Win XP/Debian
XProfan 10
07/21/08  
 



You must at least to the End of program any Controls destroy, which You too prepares have. the desires not z.B. Windows XP, but the good Program!

erstellst You means one

a%=createText(...

must You it to the End of program again

destroyWindow(a%)

destroy.

I have now not nachgesehen whether You Controls verwendest!

Only the %hWnd must/should You do not destroy, the has here and there ne Sonderbehandlung.

Nachtrag: You erstellst at least one Text one dlg and a button, at the latest to End of program should these begot Controls again over your lever by destroyWindow removes go.
 
07/21/08  
 




Jörg
Sellmeyer

erstellst You means one

a%=createText(...

must You it to the End of program again


the stops I but for a rumour! If the Elternfenster destroy becomes reicht the completely. only if one one Control with the equal Varablenbezeichnung new create wants must one it before destroy, there otherwise the grabbed hereon not any more possible is. though self then the End of program The Zerlegung Windows übernommen becomes.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
07/21/08  
 




Penguin
Tux
Sry people, but could your time again Klartext, I komm there integrally simply yet nciht so quick with. me would it recihen if I white, How I the window attend let and by the clicking of ok again vanish let.
 


OS: Win XP/Debian
XProfan 10
07/21/08  
 




Jörg
Sellmeyer
Hello Pingu,
Perhaps helps you that here Yes first moreover:
CompileMarkSeparation
Declare btn1&,dlg&,ende%

Proc Dialog

    Declare btnDlg&,dlgende%
    dlg& = CreateDialog(%hwnd,"Fenster",40,40,300,400)
    btnDlg& = CreateButton(dlg&,"verschwinden",10,10,120,30)

    WhileNot dlgende%

        WaitInput

        If GetFocus(btnDlg&)

            dlgende% = 1
            DestroyWindow(dlg&)

        EndIf

    Wend

EndProc

WindowTitle "Buttontest"
Window 10,10,500,400
btn1& = CreateButton(%hwnd,"zeigen",10,10,60,30)

WhileNot ende%

    WaitInput

    If GetFocus(btn1&)

        Dialog

    EndIf

Wend

 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
07/21/08  
 




Penguin
Tux

CompileMarkSeparation
Declare btn1&,dlg&,ende%
WindowTitle "Hilfe"
Window 10,10,500,400
btnDlg& = CreateButton(dlg&,"OK",10,10,120,30)

WhileNot dlgende%

    WaitInput

    If GetFocus(btnDlg&)

        dlgende% = 1
        DestroyWindow(dlg&)

    EndIf

Wend


The speckert now with row 5 rum. I have me whom geposteten COde simply time angeguckt and be only so far come.

Edit: I have now one "Proc Dialog" on whom beginning staid and a "EndProc" ans end, The Error Message is now of course lane, the window for too.
 


OS: Win XP/Debian
XProfan 10
07/21/08  
 




Rolf
Koch
you have end% declariert, but uses under dlgende% therefore bleats it. means
declare dlgende% instead of end% - alas and yet plenty More variables which not at all
using and be so moreover. look and compare:
CompileMarkSeparation
Declare btndlg&,dlgende%
WindowTitle "Hilfe"
Window 10,10,500,400
btnDlg& = CreateButton(%hwnd,"OK",10,10,120,30) Hier HWND wo ist denn DLG&

WhileNot dlgende%

    WaitInput

    If GetFocus(btnDlg&)

        dlgende% = 1
        DestroyWindow(dlg&) wo ist denn ein Hanlde mit DLG&?

    EndIf

Wend

 
07/21/08  
 




Penguin
Tux
OK, I have now from "ende%" "dlgende%" femacht, but the Error in the row is still not fixed.

it says "Variable not declariert: BTNDLG&"

interestingly... make I from
CompileMarkSeparation
Declare btn1&,dlg&,dlgende%
>

CompileMarkSeparation
Declare btndlg&,dlg&,dlgende%
>

äffnet itself my Window, but without Button.
 


OS: Win XP/Debian
XProfan 10
07/21/08  
 




Rolf
Koch
Have my obiges Posting extended there siehste it. see You somewhere DECLARE BTNDLG& in Your code? therefore becomes gemeckert.
 
07/21/08  
 




Penguin
Tux
thanks, now functions it. I had Yes not at all so plenty wrong, if one deliberating that I the first since yesterday make. Logisches think helps even still.

where we straight thereby are. How hit I really? I question of course plenty, but moreover since your Yes there
 


OS: Win XP/Debian
XProfan 10
07/21/08  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

24.392 Views

Untitledvor 0 min.
Georg Teles08/01/23
Thomas Freier10/06/22
Langer01/30/21
Walter01/29/19
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie