📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "客户端管理"
ClientHeight = 2730
ClientLeft = 60
ClientTop = 345
ClientWidth = 6375
LinkTopic = "Form1"
ScaleHeight = 2730
ScaleWidth = 6375
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text4
Height = 270
Left = 1800
TabIndex = 10
Text = "Text4"
Top = 1320
Width = 3375
End
Begin VB.CommandButton Command3
Caption = "浏览"
Height = 375
Left = 5280
TabIndex = 8
Top = 1280
Width = 735
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 5640
Top = 240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
Filter = "程序文件|*.exe"
End
Begin VB.TextBox Text3
Height = 270
Left = 1440
TabIndex = 7
Text = "Text3"
Top = 840
Width = 2415
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 495
Left = 4560
TabIndex = 5
Top = 2040
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 480
TabIndex = 4
Top = 2040
Width = 1335
End
Begin VB.TextBox Text2
Height = 270
Left = 1440
TabIndex = 3
Text = "Text2"
Top = 480
Width = 2415
End
Begin VB.TextBox Text1
Height = 270
Left = 1440
TabIndex = 1
Text = "Text1"
Top = 120
Width = 2415
End
Begin VB.Label Label4
Caption = "服务器名称:"
Height = 255
Left = 240
TabIndex = 9
Top = 120
Width = 1215
End
Begin VB.Label Label3
Caption = "C语言程序所在目录:"
Height = 255
Left = 120
TabIndex = 6
Top = 1320
Width = 1815
End
Begin VB.Label Label2
Caption = "服务器端口:"
Height = 255
Left = 240
TabIndex = 2
Top = 840
Width = 1095
End
Begin VB.Label Label1
Caption = "服务器IP:"
Height = 255
Left = 240
TabIndex = 0
Top = 480
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Open App.Path & "\..\config.dat" For Output As #12
Print #12, Text1.Text & Chr(16) & Chr(17)
Print #12, Text2.Text & Chr(16) & Chr(17)
Print #12, Text3.Text & Chr(16) & Chr(17)
Print #12, Text4.Text & Chr(16) & Chr(17)
Close #12
Dim i As Integer
i = MsgBox("数据以写入!是否要退出系统?", vbYesNo)
If i = 6 Then
End
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
CommonDialog1.ShowOpen
Text4.Text = CommonDialog1.FileName
End Sub
Private Sub Form_Load()
Open App.Path() & "\..\config.dat" For Binary As #11
Text1.Text = readfile(0, 11, 0)
Text2.Text = readfile(0, 11, 0)
Text3.Text = readfile(0, 11, 0)
Text4.Text = readfile(0, 11, 0)
Close #11
End Sub
Function readfile(seekid As Integer, fileid As Integer, hao As Integer) As String
'seekid是功能码用来说明本次是何操作
'fileid是文件号说明要对哪个文件进行操作
'hao:备用说明,在seekid为5或2指明要前进或后退多少,0为退2,1就是退3或进1(两行就是进2)
Dim st As String
Dim sa As String * 1
Dim sb As String * 1
Select Case seekid
Case 0
'get next
If Seek(fileid) >= LOF(fileid) Then
readfile = "seek_end"
Exit Function
End If
Do While 1
Get #fileid, , sa
If sa = Chr(16) Then
Get #fileid, , sb
If sb = Chr(17) Then
readfile = st
Seek #fileid, Seek(fileid) + 2
Exit Function
Else
Seek #fileid, Seek(fileid) - 1
End If
End If
st = st & sa
If Seek(fileid) >= LOF(fileid) Then
readfile = st
Exit Function
End If
Loop
Case 1
' go top
Seek #fileid, 1
readfile = readfile(0, fileid, 0)
Exit Function
Case 2
' go -1
If Seek(fileid) = 1 Then
readfile = readfile(0, fileid, 0)
Exit Function
End If
Dim ba As Byte
Dim bb As Byte
Dim bc As Byte
Dim bd As Byte
bc = &H10
bd = &H11
Seek #fileid, Seek(fileid) - 5
Do While 1
If Seek(fileid) = 1 Then
readfile = readfile(0, fileid, 0)
Exit Function
End If
Get #fileid, , ba
If ba = bc Then
Get #fileid, , bb
If bb = bd Then
Seek #fileid, Seek(fileid) + 2
If hao = -1 Then
readfile = readfile(0, fileid, 0)
Exit Function
Else
readfile = readfile(2, fileid, hao - 1)
Exit Function
End If
Else
Seek #fileid, Seek(fileid) - 1
End If
End If
Seek #fileid, Seek(fileid) - 2
Loop
Case 3
'go boot
Seek #fileid, LOF(fileid)
readfile = readfile(0, fileid, 0)
Exit Function
Case 5
'go N
If hao = 0 Then
readfile = readfile(0, fileid, 0)
Exit Function
End If
Dim X As Integer
For X = 1 To hao * 2
readfile = readfile(0, fileid, 0)
If readfile = "seek_end" Then
Exit Function
End If
Next
readfile = readfile(0, fileid, 0)
Exit Function
Case 9
Dim stra, strb As String
stra = ""
strb = ""
stra = readfile(0, fileid, 0)
Do While 1
strb = strb & stra & Chr(16) & Chr(17) & Chr(13) & Chr(10)
stra = readfile(0, fileid, 0)
If stra = "seek_end" Then
readfile = strb
Exit Function
End If
Loop
End Select
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -