我想利用Shell 函数来调用 Ping 应该可以吧。
此时 Ping 的参数应设为该机的IP地址。

解决方案 »

  1.   

    to yifaa:用shell函数后得到的是shell函数本身的返回值,得不到ping的返回值
      

  2.   

    自己写一个Function Ping(Byval IP as string) as Long
      

  3.   

    我的邮箱有问题了,收不到讨论。to nowcan:请说详细点
      

  4.   

    VB中检测是否连网
     
        利用WIN95中的注册表建植,在注册表的HKEY-LOCAL-MACHINE\System\CurrentControlSet\Services\RemoteAcces\下,当计算机连上因特网时,Remote Connection的植为01 00 00 00,反之,为00 00 00 00,通过这一建植可判断是否连网。 1.建立新模块 
    Public Const ERROR-SUCCESS= 0& 
    Public Const APINULL= 0& 
    Public Const HKEY-LOCAL-MACHINE= &H80000002 
    Public ReturnCode As long 
    ’声明API函数 
    RegCloseKey() 
    RegQueryValueEx() ’自定义函数 
    Public function ActiveConnection() As Boolean   Dim hKey As long 
      Dim lpSubKey As string 
      Dim lpReserved As long 
      Dim lpType As long 
      Dim lpData As long 
      Dim lpcbData As long   ActiveConnection=False 
      lpSubKey="System\CurrentControlSet\Services\RemoteAccess" 
      ReturnCode=RegOpenKey(HKEY-LOCAL-MACHINE,lpSubKey,phkResult)   If ReturnCode=ERROR-SUCCESS then 
       hKey=phkResult 
       lpValueName="Remote Connection" 
       lpReserved=APINULL 
       lpType=APINULL 
       lpData=APINULL 
       lpcbData=APINULL 
       ReturnCode=RegQueryValueEx(hKey,lpValueName,lpReserved,lpType,ByVal lpData,lpcbata) 
       lpcbData=Len(lpData) 
       ReturnCode=RegQueryValueEx(hKey,lpValueName,lpReserved,lpType,ByVal lpData,lpcbata)    If ReturnCode=ERROR-SUCCESS then 
        If lpData=0 then 
           ActiveConnection=False 
         Else 
           ActiveConnection=True 
         End If 
       End If 
       RegCloseKey(hKey) 
     End If 
    End funtion 2.新建窗体 
    Priate sub Command1_click() 
     If ActiveConnection=True then 
      MsgBox "OK!" 
     Else 
      MsgBox "ERROR!" 
     End If 
    End sub
     
    摘自:
       http://ilike.myrice.com/program/article/vb/vb532.html