Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pinging an IP Address 4

Status
Not open for further replies.

sheronne

Programmer
Jun 1, 2001
71
0
0
US
Is there anyway to PING an IP Address using foxpro?
 
Hi ramani,
Well I kept playing with it and got it to work.

Your code was:
Code:
private strIPCopy
    m.strIPCopy = ''
    m.strIPCopy = "run /N7 ping " + m.computername ;
                  + ">c:\mas\temp\ping.txt"
    STRTOFILE(m.strIPCopy,"myPing.bat")
    RUN /N7 myPing.Bat

I found I did not need the "run /N7" in the string. So code is now:


Code:
private strIPCopy
    m.strIPCopy = ''
    m.strIPCopy = "ping " + m.computername ;
                  + ">c:\mas\temp\ping.txt"
    STRTOFILE(m.strIPCopy,"myPing.bat")
    RUN /N7 myPing.Bat

Thanks for all your help.
Jdemmer
 
Jdemmer

Have you tried WinExec Api Call?

It's worked for me in the past, when I didn't want the D.O.S. window to pop-flash:


#DEFINE SW_HIDE 0
#DEFINE SW_SHOWNORMAL 1
#DEFINE SW_SHOWMINIMIZED 2
#DEFINE SW_SHOWMAXIMIZED 3
#DEFINE SW_SHOWNOACTIVATE 4
#DEFINE SW_SHOW 5
#DEFINE SW_MINIMIZE 6
#DEFINE SW_SHOWMINNOACTIVE 7
#DEFINE SW_SHOWNA 8
#DEFINE SW_RESTORE 9
#DEFINE SW_SHOWDEFAULT 10

DECLARE INTEGER WinExec IN kernel32;
STRING lpCmdLine,;
INTEGER nCmdShow

lpCmdLine="YourCommand.Bat"

** or whatever
? WinExec (lpCmdLine, SW_SHOWMINNOACTIVE)

** Minimized and not activated, runs in the background

This was an example. It worked for me using SW__SHOWMINNOACTIVE



Acknowledgement:



By the way, this is site I allways recommend.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top