当前位置:首页 » 《随便一记》 » 正文

IFIX上位机网络测试画面_卡哇伊大喵的博客

17 人参与  2022年05月10日 17:23  分类 : 《随便一记》  评论

点击全文阅读


IFIX上位机添加IP测试

效果

 

 实现画面

实现脚本

Option Explicit
 
Private Declare Function GetExitCodeProcess Lib "kernel32" ( _
        ByVal hProcess As Long, _
        lpExitCode As Long) As Long
 
Private Declare Function CloseHandle Lib "kernel32" ( _
        ByVal hObject As Long) As Long
 
Private Declare Function OpenProcess Lib "kernel32" ( _
        ByVal dwDesiredAccess As Long, _
        ByVal bInheritHandle As Long, _
        ByVal dwProcessId As Long) As Long
        
Const PROCESS_QUERY_INFORMATION = &H400
Const STILL_ALIVE = &H103

Private Sub Text2_Click()
    
    Dim pid As Long
    pid = Shell("cmd.exe /C Ping " & "192.168.0.135" & " > c:\ipaac.txt", vbHide)
    Dim hProc As Long
    hProc = OpenProcess(PROCESS_QUERY_INFORMATION, 0, pid)
    Dim ExitCode As Long
    Do
        Call GetExitCodeProcess(hProc, ExitCode)
        DoEvents
    Loop While ExitCode = STILL_ALIVE
    
    Text3.Caption = ""
 
    Open "c:\ipaac.txt" For Input As #1
    Dim strLine As String
    Do Until EOF(1)
        Line Input #1, strLine
        Text3.Caption = Text3.Caption & strLine & vbNewLine
    Loop
     
    Close #1
    On Error Resume Next
    Kill "c:\ipaac.txt"
    On Error GoTo 0

End Sub


点击全文阅读


本文链接:http://m.zhangshiyu.com/post/39872.html

上位  脚本  画面  
<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1