Form1.frm
上传用户:gainingqun
上传日期:2015-05-26
资源大小:2k
文件大小:4k
- VERSION 5.00
- Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 5610
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 5130
- LinkTopic = "Form1"
- ScaleHeight = 5610
- ScaleWidth = 5130
- StartUpPosition = 3 '窗口缺省
- Begin MSWinsockLib.Winsock Winsock1
- Left = 2160
- Top = 5280
- _ExtentX = 741
- _ExtentY = 741
- _Version = 393216
- End
- Begin VB.Frame Frame1
- Height = 1215
- Left = 120
- TabIndex = 2
- Top = 120
- Width = 4935
- Begin VB.CommandButton Command1
- Caption = "连接"
- Height = 855
- Left = 3360
- TabIndex = 7
- Top = 240
- Width = 1095
- End
- Begin VB.TextBox Text4
- Height = 375
- Left = 1080
- TabIndex = 4
- Text = "Text4"
- Top = 720
- Width = 1935
- End
- Begin VB.TextBox Text3
- Height = 375
- Left = 1080
- TabIndex = 3
- Text = "Text3"
- Top = 240
- Width = 1935
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- Caption = "端口:"
- Height = 180
- Left = 360
- TabIndex = 6
- Top = 720
- Width = 540
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "服务器:"
- Height = 180
- Left = 240
- TabIndex = 5
- Top = 360
- Width = 720
- End
- End
- Begin VB.TextBox Text2
- Height = 375
- Left = 0
- TabIndex = 1
- Top = 4800
- Width = 5055
- End
- Begin VB.TextBox Text1
- BackColor = &H80000007&
- ForeColor = &H80000005&
- Height = 3255
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 0
- Top = 1440
- Width = 4935
- End
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- On Error GoTo 1
- Form1.Winsock1.Close
- Form1.Winsock1.Connect Text3.Text, Text4.Text
- SaveSetting "Telnetclient", "Last", "Server", Text1.Text
- SaveSetting "Telnetclient", "Last", "Port", Text2.Text
- Exit Sub
- 1 MsgBox Err.Description, vbCritical
- Form1.Winsock1.Close
- End Sub
- Private Sub Form_Load()
- a = GetSetting("Telnetclient", "Last", "Server", "")
- If a = "" Then
- Else
- End If
- Text3.Text = GetSetting("Telnetclient", "Last", "Server", "")
- Text4.Text = GetSetting("Telnetclient", "Last", "Port", 23)
- End Sub
- Private Sub Text1_Change()
- Text1.SelStart = Len(Text1.Text)
- Text2.SetFocus
- End Sub
- Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
- KeyCode = 0
- End Sub
- Private Sub Text2_KeyPress(KeyAscii As Integer)
- On Error GoTo 1
- If KeyAscii = 13 Then
- Text2.Text = ""
- Winsock1.SendData Chr(13)
- KeyAscii = 0
- Else
- Winsock1.SendData Chr(KeyAscii)
- End If
- Exit Sub
- 1 KeyAscii = 0
- End Sub
- Private Sub Winsock1_Close()
- MsgBox "断开连接!"
- Winsock1.Close
- End Sub
- Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
- Winsock1.GetData buffer$, vbString
- Text1.Text = Text1.Text & buffer$
- End Sub