Results 1 to 3 of 3

Thread: using shellexecute

  1. #1
    nickhills
    Guest

    using shellexecute

    Hello all,

    I wonder if anyone can take a peep at this code and suggest where I might be going wrong..

    Public Function CheckIP(a, b, c, d As String) As Boolean

    'declare variable to hold ip
    Dim ip_addr
    'build ip_addr
    ip_addr = a & "." & b & "." & c & "." & d

    'declare status var
    Dim pingOk

    'call ping application
    pingOk = ShellExecute(vbNullString, vbNullString, "ping.exe", ip_addr, vbNullString, vbNormalFocus)

    'returns true if ping has worked
    CheckIP = True

    End Function

    The error I get is type mismatch on:

    pingOk = ShellExecute(vbNullString, vbNullString, "ping.exe", ip_addr, vbNullString, vbNormalFocus)

    I’m not quite sure this is the right syntax, as I am coming more from the c/c++ side of things with regards to shellexecute.

    Also does anyone know of a way to catch the output of ping.exe in the program, without having to echo ping.exe to a text file?

    Thanks,
    nick

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    have u tried using shell ?

    Shell "PING.EXE 192.168.0.200"
    -= a peet post =-

  3. #3
    New Member
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    14
    have you tried 'Dim pingOk As Long' ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width