?? form1.frm
字號:
VERSION 5.00
Object = "{74848F95-A02A-4286-AF0C-A3C755E4A5B3}#1.0#0"; "actskn43.ocx"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form1
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "星零排課系統登陸"
ClientHeight = 3195
ClientLeft = 45
ClientTop = 435
ClientWidth = 5130
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 5130
StartUpPosition = 1 '所有者中心
Begin VB.TextBox Text3
Height = 375
Left = 5160
TabIndex = 7
Text = "Text3"
Top = 3000
Width = 495
End
Begin MSWinsockLib.Winsock Winsock1
Left = 4440
Top = 240
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 600
Top = 240
End
Begin VB.CommandButton Command3
Appearance = 0 'Flat
Caption = "點此訪問愛星零工作室網站(http://www.lovexl.com.cn)"
Height = 375
Left = 0
TabIndex = 6
Top = 2880
Width = 5175
End
Begin VB.CommandButton Command2
Caption = "退 出"
Height = 375
Left = 2760
MouseIcon = "Form1.frx":F84A
MousePointer = 99 'Custom
TabIndex = 5
Top = 2160
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "確 定"
Height = 375
Left = 1080
MouseIcon = "Form1.frx":F99C
MousePointer = 99 'Custom
TabIndex = 2
Top = 2160
Width = 1215
End
Begin ACTIVESKINLibCtl.Skin PKSkn
Left = 1440
OleObjectBlob = "Form1.frx":FAEE
Top = 240
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 345
IMEMode = 3 'DISABLE
Left = 2160
PasswordChar = "*"
TabIndex = 1
Text = "admin"
Top = 1440
Width = 1815
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 345
Left = 2160
TabIndex = 0
Text = "admin"
Top = 840
Width = 1815
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel1
Height = 375
Left = 1080
OleObjectBlob = "Form1.frx":FD22
TabIndex = 3
Top = 840
Width = 1335
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel2
Height = 375
Left = 1080
OleObjectBlob = "Form1.frx":FD86
TabIndex = 4
Top = 1440
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim DataByte() As Byte
Public Dw_Url As String
Dim StartTime As Date '連接服務器的時間
Dim UPI As Boolean
Private Sub Command1_Click()
On Error GoTo finish
'on error goto是一個防錯代碼,當出現錯誤,系統會自動轉到后面的finish:后執行
Set kc1 = cnn.Execute("select * from 登陸 where 用戶名='" & Text1.Text & "' and 密碼='" & Text2.Text & "'")
'這里是執行了確定按鈕后在登陸表中檢索用戶名和密碼是否正確,如kc1的記錄集指針指向尾部,即eof時
'提示用戶名或密碼錯誤,并把當前允許輸入錯誤次數+1,當用戶輸入的錯誤次數大于2即=3的時候則直接退出系統
If kc1.EOF = True Then
If pnum < 2 Then
pnum = pnum + 1
MsgBox "用戶名或密碼錯誤!", vbInformation, "錯誤次數:" & pnum
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus '提示用戶名或密碼錯誤后將光標自動定位到text1窗體上
Exit Sub
Else
MsgBox "用戶名或密碼錯誤超過三次,系統會自動退出", vbInformation, "提示"
End
End If
Else
'當當前記錄集不為空時,獲取記錄集的第2個字段是否等于超級管理員,是則admin全局變量的布爾值為true,否則為假
'這個值在formmain里會通過獲取的來定義某些按鈕可用,某些不可用
'kc1.fields(2)此處的2其實在數據庫表中表現應為第3個字段,因為記錄集獲取是從0開始的,而數據庫表中的記錄字段則
'是從1開始的,所以兩者之前總是相差1
If kc1.Fields(2) = "超級管理員" Then
admin = True
Else
admin = False
End If
Unload Me
formmain.Show
End If
Exit Sub
finish: '當出現錯誤轉到此處,提示錯誤標識
MsgBox Err.Description
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Shell "Explorer /s , http://www.lovexl.com.cn"
End Sub
Private Sub Form_Load()
If EXIT_UP = False Then
VersionNumber_load
End If
Me.Caption = Me.Caption & " 版本(" & Str(VersionN) & ")"
pkskn.LoadSkin App.Path & "\chizh.skn"
pkskn.ApplySkinByName hWnd, "窗體"
pkskn.ApplySkin hWnd
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then '當當前獲取按鈕是回車鍵時執行按鈕image_click事件
Call Command1_Click
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command1_Click
End If
End Sub
Private Sub VersionNumber_load() '客戶端設置讀取機器ID快捷識別編號
Dim buff As String
Dim backFile As String
Dim ret As Integer
buff = String(255, 0)
ret = GetPrivateProfileString("Ver", "Ver", "", buff, 256, App.Path & "\PK.ini")
If ret = 0 Then
VersionN = "1.00"
ret = WritePrivateProfileString("Ver", "Ver", VersionN, App.Path & "\PK.ini")
Else
VersionN = buff
End If
'獲取升級說明路徑
ret = GetPrivateProfileString("Ver", "IP", "", buff, 256, App.Path & "\PK.ini")
If ret = 0 Then
ret = WritePrivateProfileString("Ver", "IP", "www.ah163.net.cn", App.Path & "\PK.ini")
Else
Text3.Text = buff
UPIP = Text3.Text
End If
'獲取升級說明路徑
ret = GetPrivateProfileString("Ver", "UPLIST", "", buff, 256, App.Path & "\PK.ini")
If ret = 0 Then
ret = WritePrivateProfileString("Ver", "UPLIST", "http://www.ah163.net.cn/lovexl/pkupdate/uplist.up", App.Path & "\PK.ini")
Else
UPlist = buff
End If
'獲取URL網頁
ret = GetPrivateProfileString("Ver", "UPURL", "", buff, 256, App.Path & "\PK.ini")
If ret = 0 Then
ret = WritePrivateProfileString("Ver", "UPURL", "http://www.ah163.net.cn/lovexl/pkupdate/update.up", App.Path & "\PK.ini")
Else
UPURL = buff
UPTT
End If
End Sub
Public Sub UPTT()
StartTime = Time()
If Winsock1.State = 0 Then '或0,6代表正在連接,7代表連接成功
Winsock1.RemoteHost = UPIP '返回或設置遠程計算機,控件向它發送數據或從它那里接收數據。既可提供主機名,比如 "FTP://ftp.microsoft.com",也可提供點格式下的 IP 地址字符串,比如 "100.0.1.1"。
Winsock1.RemotePort = 80 '返回或設置要連接的遠程端口號
Winsock1.Connect
End If
Do While Winsock1.State <> sckConnected
DoEvents: DoEvents:
'連接時間超過20秒或取消下載,退出該過程并返回false
If DateDiff("s", StartTime, Time()) > 3 Then
Exit Sub
End If
Loop
Text3.Text = UPURL '必須經過文本處理,否則將會有許多未知字符出錯
strcommand = "GET " + Text3.Text + " HTTP/1.0" + vbCrLf 'GET 為FTP命令
strcommand = strcommand + vbCrLf '記住一定要加上vbCrLf
FileName = App.Path & "\" & "update.up"
If Dir(FileName, vbNormal) <> "" Then
Kill FileName
End If
bAppend = False
Winsock1.SendData strcommand ''給遠程計算機發送數據
Timer1.Enabled = True
End Sub
Private Sub Ver_compare() '版本比較
If Dir(FileName, vbNormal) <> "" Then
Dim strinput As String
Dim intfile As Integer
Dim str1() As String
Dim filesize As Double
intfile = FreeFile
filesize = FileLen(FileName)
Open FileName For Binary As #intfile
strinput = Space(filesize)
Get #intfile, , strinput
Close #intfile
str1 = Split(strinput, vbCrLf)
If UBound(str1) > 0 Then
NEW_VersionN = str1(0)
If Mid(VersionN, 1, 4) <> NEW_VersionN Then
Form4.Show
Unload Me
Form1.Refresh
End If
End If
End If
End Sub
Private Sub Timer1_Timer()
If UPboolean = True Then
UPboolean = False
If FileLen(FileName) >= filesize Then
Ver_compare
End If
UPI = True
Timer1.Enabled = False
End If
End Sub
Private Sub Winsock1_Close()
Winsock1.Close
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim ByteData1() As Byte
'文件總長度的變量
Dim Flen1 As Long
'請求服務器返回的響應碼
Dim ReCode1 As String
Winsock1.GetData ByteData1, vbByte, bytesTotal
'下載數據保存數據,如果是連接后第一次返回的數據,返回服務器的響應碼
ReCode1 = SaveData(bytesTotal, ByteData1(), Flen1)
DoEvents '控制切換
Select Case ReCode1
Case "200"
'響應碼為200表示成功
Case "206"
'響應碼206表示斷點續傳成功
Case "404"
'響應碼為404表示請求的下載的文件未找到
MsgBox "文件不存在!", vbInformation, "下載失敗"
Winsock1.Close
Case "error"
'其他響應碼視為錯誤
Winsock1.Close
MsgBox "請求出錯!", vbInformation, "下載失敗"
Case "cancel"
'用戶取消
Exit Sub
End Select
If Flen1 > 0 Then
'如果任務第一次下載,則保存后得到文件長度
filesize = Flen1
End If
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Winsock1.Close
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -