【文章內容簡介】
, vbOKOnly, 警告 ) If respond vbOKOnly Then = = username = password = End If Else userright = (權限 ) Unload frmlogin End If Exit Sub err1: MsgBox 系統(tǒng)配置錯誤!無法與服務器連 接! userright = 0 Unload Me End Sub Private Sub Command2_Click() End End Sub Private Sub Form_Load() = = 39。conn = conn = Provider=。Data Source= amp。 amp。 \。Persist Security Info=False End Sub 2. 用戶修改密碼界面設計 : 代碼設計 : Private Sub Command1_Click() On Error GoTo err1 username = If And Then = select * from usertab where 用戶名 =39。 amp。 username amp。 39。 and 密碼 = amp。 39。 amp。 amp。 39。 If = adPosUnknown Then MsgBox 舊密碼錯誤 ! = = Else (密碼 ) = MsgBox 密碼修改 成功! = = End If Else MsgBox 新舊密碼均不得為空! End If Exit Sub err1: MsgBox 遠程服務器連接失敗! End Sub Private Sub Command2_Click() = = End Sub Private Sub Command3_Click() Unload Me End Sub Private Sub Form_Load() On Error GoTo err2 = ( ) / 2 500 = ( ) / 2 = = = Exit Sub err2: MsgBox 遠程服務器連 接失?。? End Sub Private Sub Form_Unload(Cancel As Integer) (2) = 目前沒有窗口被激活 End Sub Private Sub Form_Activate() (2) = 活動窗口: amp。 End Sub 3,關于界面設計 : 代碼設計 : Private Sub cmdOK_Click() Unload Me End Sub Private Sub Form_Load() = ( ) / 2 500 = ( ) / 2 = 關于 amp。 = End Sub Public Sub StartSysInfo() On Error GoTo SysInfoErr Dim rc As Long Dim SysInfoPath As String 39。 試圖從注冊表中獲得系統(tǒng)信息程序的路徑及名稱 ... If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then 39。 試圖僅從注冊表中獲得系統(tǒng)信息程序的路徑 ... ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then 39。 已知 32 位文件版本的有效位置 If (Dir(SysInfoPath amp。 \) ) Then SysInfoPath = SysInfoPath amp。 \ 39。 錯誤 文件不能被 找到 ... Else GoTo SysInfoErr End If 39。 錯誤 注冊表相應條目不能被找到 ... Else GoTo SysInfoErr End If Call Shell(SysInfoPath, vbNormalFocus) Exit Sub SysInfoErr: MsgBox 此時系統(tǒng)信息不可用 , vbOKOnly End Sub Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean Dim i As Long 39。 循環(huán)計數(shù)器 Dim rc As Long 39。 返回代碼 Dim hKey As Long 39。 打開的注冊表關鍵字句柄 Dim hDepth As Long 39。 Dim KeyValType As Long 39。 注冊表關鍵字數(shù)據(jù)類型 Dim tmpVal As String 39。 注冊表關鍵字值的臨時存儲器 Dim KeyValSize As Long 39。 注冊表關鍵自變量的尺寸 39。 39。 打開 {HKEY_LOCAL_MACHINE...} 下的 RegKey 39。 rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) 39。 打開注冊表關鍵字 If (rc ERROR_SUCCESS) Then GoTo GetKeyError 39。 處理錯誤 ... tmpVal = String$(1024, 0) 39。 分配變量空間 KeyValSize = 1024 39。 標記變量尺寸 39。 39。 檢索注冊表關鍵字的值 ... 39。 rc = RegQueryValueEx(hKey, SubKeyRef, 0, _ KeyValType, tmpVal, KeyValSize) 39。 獲得 /創(chuàng)建關鍵字值 If (rc ERROR_SUCCESS) Then GoTo GetKeyError 39。 處理錯誤 If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then 39。 Win95 外接程序空終結字符串 ... tmpVal = Left(tmpVal, KeyValSize 1) 39。 Null 被找到 ,從字符串中分離出來 Else 39。 WinNT 沒有空終結字符串 ... tmpVal = Left(tmpVal, KeyValSize) 39。 Null 沒有被找到 , 分離字符串 End If 39。 39。 決定轉換的關鍵字的值類型 ... 39。 Select Case KeyValType 39。 搜索數(shù)據(jù)類型 ... Case REG_SZ 39。 字符串注冊關鍵字數(shù)據(jù)類型 KeyVal = tmpVal 39。 復制字符串的值 Case REG_DWORD 39。 四字節(jié)的注冊表關鍵字數(shù)據(jù)類型 For i = Len(tmpVal) To 1 Step 1 39。 將每位進行轉換 KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1))) 39。 生成值字符。 By Char。 Next KeyVal = Format$(amp。h + KeyVal) 39。 轉換四字節(jié)的字符為字符串 End Select GetKeyValue = True 39。 返回成功 rc = RegCloseKey(hKey) 39。 關閉注冊表關鍵字 Exit Function 39。 退出 GetKeyError: 39。 錯誤發(fā)生后將其清除 ... KeyVal = 39。 設置返回值到空字符串 GetKeyValue = False 39。 返回失敗 rc = RegCloseKey(hKey) 39。 關閉注冊表關鍵字 End Function Private Sub Form_Unload(Cancel As Integer) (2) = 目前沒有窗口被激活 End Sub Private Sub Form_Activate() (2) = 活動窗口: amp。 End Sub 4:庫存登記界面設計 : 代碼設計 : Public Sub Guolu() With Adodc1 .RecordSource = select * from amp。 amp。 where 失效標記 =false .Refresh For i = 0 To . If Not . Then If .(失效期 ) = Date Then .(失效標記 ) = True . Else .(失效標記 ) = False