⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.frm

📁 vb+sql实例源码!希望大家交流学习.QQ:34506847!谢谢.
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmMain 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "读取 Mixrosoft Access 数据库密码"
   ClientHeight    =   2145
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   2145
   ScaleWidth      =   4680
   StartUpPosition =   2  '屏幕中心
   Begin MSComDlg.CommonDialog cdlg 
      Left            =   2100
      Top             =   825
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      DefaultExt      =   ".mdb"
      DialogTitle     =   "查找 Access 数据库文件"
      Filter          =   "Microsoft Access 数据库|*.mdb"
   End
   Begin VB.Frame famPassWord 
      Caption         =   "读取密码"
      Height          =   855
      Left            =   135
      TabIndex        =   3
      Top             =   1125
      Width           =   4395
      Begin VB.CommandButton cmdUnLock 
         Caption         =   "解密(&U)"
         Default         =   -1  'True
         Height          =   310
         Left            =   3285
         TabIndex        =   4
         Top             =   330
         Width           =   900
      End
      Begin VB.Label lblPassWord 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Height          =   300
         Left            =   195
         TabIndex        =   5
         Top             =   330
         Width           =   3090
      End
   End
   Begin VB.Frame famDataBaseName 
      Caption         =   "Microsoft Access 数据库"
      Height          =   855
      Left            =   135
      TabIndex        =   0
      Top             =   135
      Width           =   4395
      Begin VB.CommandButton cmdBrowse 
         Caption         =   "浏览(&B)"
         Height          =   310
         Left            =   3285
         TabIndex        =   2
         Top             =   330
         Width           =   900
      End
      Begin VB.TextBox txtDBName 
         Height          =   300
         Left            =   195
         TabIndex        =   1
         Top             =   330
         Width           =   3090
      End
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private DBName$, oldPath$

'Browse database file.
Private Sub cmdBrowse_Click()
    lblPassWord.Caption = ""
    
    oldPath$ = DBName$
    
    cdlg.InitDir = DBName$
    cdlg.ShowOpen
    DBName$ = cdlg.FileName
    If DBName$ = "" Then DBName$ = oldPath$: Exit Sub
    txtDBName.Text = DBName$
End Sub


'Read database password.
Private Sub cmdUnLock_Click()
    'First check the file
    'If find file then go on,else exit unlock.
    If Dir(txtDBName.Text) = "" Then
        'Not find file
        MsgBox "指定的数据库文件并不存在,请重新确定数据库名。", vbOKOnly + vbCritical, "错误"
        lblPassWord.Caption = "指定的文件并不存在"
        txtDBName.SetFocus
        Exit Sub
    End If
    
    If LCase(Right(txtDBName.Text, 3)) <> "mdb" Then
        'It's not a mdb database
        MsgBox "指定的文件并不是一个 Access 数据库文件。", vbOKOnly + vbCritical, "错误"
        lblPassWord.Caption = "文件不是 Access 数据库文件"
        Exit Sub
    End If
    
    On Error GoTo Err:
    
    Dim strBytes(13) As Byte
    
    Open txtDBName.Text For Binary Access Read As #1
    
    Get #1, 67, strBytes
    
    Close #1
    
    Dim strPW$
    
    strPW = ""
    
    If (strBytes(0) Xor 134) = 0 Then
        lblPassWord.Caption = "该数据库没有密码"
    Else
        strPW = strPW & Chr$(strBytes(0) Xor &H86)
        strPW = strPW & Chr$(strBytes(1) Xor &HFB)
        strPW = strPW & Chr$(strBytes(2) Xor &HEC)
        strPW = strPW & Chr$(strBytes(3) Xor &H37)
        strPW = strPW & Chr$(strBytes(4) Xor &H5D)
        strPW = strPW & Chr$(strBytes(5) Xor &H44)
        strPW = strPW & Chr$(strBytes(6) Xor &H9C)
        strPW = strPW & Chr$(strBytes(7) Xor &HFA)
        strPW = strPW & Chr$(strBytes(8) Xor &HC6)
        strPW = strPW & Chr$(strBytes(9) Xor &H5E)
        strPW = strPW & Chr$(strBytes(10) Xor &H28)
        strPW = strPW & Chr$(strBytes(11) Xor &HE6)
        strPW = strPW & Chr$(strBytes(12) Xor &H13)
        
        lblPassWord.Caption = "该数据库的密码为:" + strPW
    End If
    
    Exit Sub
Err:
    MsgBox "未知的错误,无法解读密码。", vbCritical, "错误"
End Sub


Private Sub Form_Load()
    DBName$ = App.Path
End Sub

'Get focus then select all text.
Private Sub txtDBName_GotFocus()
    With txtDBName
        .SelStart = 0
        .SelLength = Len(.Text)
    End With
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -