您好,欢迎光临本网站![请登录][注册会员]  
文件名称: vb-第一手
  所属分类: 其它
  开发工具:
  文件大小: 635kb
  下载次数: 0
  上传时间: 2013-11-07
  提 供 者: u0127*****
 详细说明: Private Sub Command1_Click() '連結 On Error Resume Next Winsock5.Close Winsock5.Connect "140.124.39.112", "502" Winsock1.Close Winsock1.Connect "140.124.39.112", "502" Winsock2.Close Winsock2.Connect "140.124.39.112", "502" Winsock3.Close Winsock3.Connect "140.124.39.112", "502" Winsock4.Close Winsock4.Connect "140.124.39.112", "502" If Err Then MsgBox "傳輸失敗" & Err.Description, vbCritical, "網路連結" Err.Clear En d If End Sub Private Sub Command2_Click() '轉速偵測 On Error GoTo ErrProc Timer1.Enabled = True Exit Sub ErrProc: MsgBox "傳輸數據失敗", vbCritical, "網絡傳輸" End Sub Private Sub Command3_Click() '馬達啟動 On Error GoTo ErrProc Dim sendstr(12) As Byte sendstr(0) = &H0 '交換識別號高字節,通常為0 sendstr(1) = &H0 '交換識別號低字節,通常為0 sendstr(2) = &H0 '協議識別號高字節,為 0 sendstr(3) = &H0 '協議識別號低字節,為 0 sendstr(4) = &H0 '字節長度高字節 sendstr(5) = &H6 '以下字節長度低字節 sendstr(6) = &HFF '單元識別號,確省為 255 sendstr(7) = &H5 '寫一個線圈命令代碼 sendstr(8) = &H5 '寫線圈的起始地址高字節 sendstr(9) = &H2 '寫線圈的起始地址低字節 sendstr(10) = &HFF '=FF打開線圈,=00關閉線圈 sendstr(11) = &H0 ' Dim aStr As String Dim I, j As Integer For I = 0 To 11 aStr = aStr & Chr(sendstr(I)) Next Winsock2.SendData aStr Exit Sub ErrProc: MsgBox "傳輸數據失敗", vbCritical, "網絡傳輸" End Sub Private Sub Command4_Click() '位置偵測 On Error GoTo ErrProc Timer2.Enabled = True Exit Sub ErrProc: MsgBox "傳輸數據失敗", vbCritical, "網絡傳輸" End Sub Private Sub Command5_Click() Timer1.Enabled = False End Sub Private Sub Command6_Click() With Command6 .Tag = "0" .Tag = "1" .Caption = "計時中" Label5 = "計時中" TimerOff = False Timer3.Enabled = True End With End Sub Private Sub Command7_Click() TimerOff = True End Sub Private Sub Command8_Click() On Error GoTo ErrProc Dim sendstr(12) As Byte sendstr(0) = &H0 '交換識別號高字節,通常為0 sendstr(1) = &H0 '交換識別號低字節,通常為0 sendstr(2) = &H0 '協議識別號高字節,為 0 sendstr(3) = &H0 '協議識別號低字節,為 0 sendstr(4) = &H0 '字節長度高字節 sendstr(5) = &H6 '以下字節長度低字節 sendstr(6) = &HFF '單元識別號,確省為 255 sendstr(7) = &H5 '寫一個線圈命令代碼 sendstr(8) = &H5 '寫線圈的起始地址高字節 sendstr(9) = &H0 '寫線圈的起始地址低字節 sendstr(10) = &HFF '=FF打開線圈,=00關閉線圈 sendstr(11) = &H0 ' Dim gStr As String Dim I, j As Integer For I = 0 To 11 gStr = gStr & Chr(sendstr(I)) Next Winsock4.SendData gStr Exit Sub ErrProc: MsgBox "傳輸數據失敗", vbCritical, "網絡傳輸" End Sub Private Sub Command9_Click() Dim sendstr(12) As Byte sendstr(0) = &H0 '交換識別號高字節,通常為0 sendstr(1) = &H0 '交換識別號低字節,通常為0 sendstr(2) = &H0 '協議識別號高字節,為 0 sendstr(3) = &H0 '協議識別號低字節,為 0 sendstr(4) = &H0 '字節長度高字節 sendstr(5) = &H6 '以下字節長度低字節 sendstr(6) = &HFF '單元識別號,確省為 255 sendstr(7) = &H5 '寫一個線圈命令代碼 sendstr(8) = &H5 '寫線圈的起始地址高字節 sendstr(9) = &H2 '寫線圈的起始地址低字節 sendstr(10) = &H0 '=FF打開線圈,=00關閉線圈 sendstr(11) = &H0 ' Dim hStr As String Dim I, j As Integer For I = 0 To 11 hStr = hStr & Chr(sendstr(I)) Next Winsock5.SendData hStr Exit Sub ErrProc: MsgBox "傳輸數據失敗", vbCritical, "網絡傳輸" End Sub ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: vb
 输入关键字,在本站1000多万海量源码库中尽情搜索: