- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ c_c_lai
¥[¤JdoeventsÁÙ¬O¤£¦æ¡CªGµM¬O§ä¤£¨ìcommand«ü¥O¡A¤£ª¾¦³µL¨ä¥¦´À¥N¤èªk¡H¤£¦n·N«ä¡A¤U¯Z¤F ...
linderlong µoªí©ó 2013-8-30 16:59
¶¢¶¢µL¨Æ¡A¶K¤W´XÓ Function¡A ¦Û¤v¬Ý¬ÝþºØ¾A¥Î¡C
1. ´ú¸Õ¥Dµ{¦¡¡G- Sub TestPing()
- Dim xi As Integer
-
- xi = 1
- Do
- If Cells(xi, 1) <> "" Then
- ' MsgBox sPing("www.microsoft.com")
- ' Cells(xi, "C") = sPing("www.google.com")
- Cells(xi, "C") = Ping2("www.google.com")
- ' Cells(xi, "C") = sPing(Cells(xi, 1))
- ' Cells(xi, "C") = IsConnectible(Cells(xi, 1))
- End If
- xi = xi + 1
- Loop Until Cells(xi, 1) = ""
- End Sub
½Æ»s¥N½X ¥H¤U¬°µ{¦¡¼Ò²Õ¡A§A¥i¥H¤@¤@´ú´ú¬Ý¡G- Private Function Ping2(strAddr As String) As String
- Dim strTmpFile As String
-
- strTmpFile = Environ("TEMP") & "\PingResult.txt" ' ·Ç³Æ«Ø¼È¦sÀɦb Windows Temp ¥Ø¿ý¤U
- ' «Ø¥ß WScript ª«¥ó Shell Ãþ§O , ¨Ï¥Î Run ¤èªk , ©I¥s¥~³¡«ü¥O Ping ( ¨Ãµ¥«Ý¨ä°õ¦æµ²§ô )
- CreateObject("WScript.Shell").Run Environ("COMSPEC") & " /c PING " & strAddr & " > " & strTmpFile, 0, True
- ' PS : "Ping IP¦ì¸m > XXÀÉ®×" ³o¸Ì¬O¨Ï¥Î > ¨Ó±N Ping µ²ªG¼g¨ìÀɮ׸Ì
- ' ( ·íµM¤]¥i Call API CreatePipe ¨ÓŪ¨ú©R¥Oµ²ªG )
- ' Ping ¬O¤@ºØ¤½¥Îµ{¦¡¡A¥i¥HÅçÃÒ¤@©Î¦hÓ»·ºÝ¥D¾÷³s½u¡C
- ' Ping «ü¥O¥Î ICMP ¦^À³n¨D©M¦^À³¦^ÂЮM¸Ë³nÅé¨Ó¨M©wºô¸ô¤Wªº¯S®í IP ¨t²Î¬O§_¥¿±`¹B§@¡C
- ' Ping ¹ï¶EÂ_ IP ºô¸ô©Î¸ô¥Ñ¾¹¥¢±Ñ«D±`¦³¥Î¡C
- ' Internet Control Message Protocol (ICMP)
- ' TCP/IP ²Õ¥ó¤¤¥²nªº¤@ºØºûÅ@³q°T¨ó©w¡A¥i³ø§i¿ù»~¨Ã¤¹³\²©ö³s½u¡C
- ' Ping ¤u¨ã¥Î¨Ó°õ¦æ TCP/IP ºÃÃø±Æ¸Ñªº ICMP¡C
- ' ¸Ô²Ó»¡©ú¤Î¥Îªk¥i°Ñ¦Ò:
- ' ms-its:%WINDIR%\Help\ntcmds.chm::/ping.htm
- ' ms-its:%WINDIR%\Help\ntcmds.chm::/ping.htm
- ' ms-its:%WINDIR%\Help\tcpip.chm::/sag_TCPIP_pro_PingConnect.htm
- ' ms-its:%WINDIR%\Help\tcpip.chm::/sag_TCPIP_pro_Ping.htm
- ' «Ø¥ßÀɮרt²Îª«¥ó,¥Î¨Ó¶}±Ò¼È¦s¤å¦rÀÉ,¨ÃŪ¨ú¤º®e ( ¨ú¦^ Pingªºµ²ªG )
- Ping2 = CreateObject("Scripting.FileSystemObject").OpenTextFile(strTmpFile).ReadAll
- Ping2 = Replace(Ping2, vbCrLf, "", 1)
-
- On Error Resume Next
- Kill strTmpFile ' §R°£¼È¦sÀÉ
- End Function
½Æ»s¥N½X |
|