·ÀÖ¹Access 2000ÃÜÂë±»ÆÆÒëµÄ·½·¨
Èç¹ûÄã¹ý·ÖÐÅÈÎ Access 2000Êý¾Ý¿âµÄÃÜÂë±£»¤£¬Äã¿ÉÄÜ»áÒò´Ë¶øÃÉÊÜËðʧ¡£ÕâÊÇÒòΪAccess 2000µÄÊý¾Ý¿â¼¶ÃÜÂë²¢²»°²È«£¬Ïà·´ËüºÜ´àÈõ£¬ÉõÖÁÏÂÃæÕâ¶Î·Ç³£Ð¡µÄ³ÌÐò¾Í¿ÉÒÔ¹¥ÆÆËü£º ¡¡ ' ³ÌÐòÒ»£¨VB6£©£ºAccess 2000ÃÜÂëÆÆÒë Private Sub Command1_Click() Const Offset = &H43; ' ÎļþÆ«ÒƵØÖ·£ºAccessÊý¾Ý¿â´Ó´Ë´¦¿ªÊ¼´æ·Å¼ÓÃÜÃÜÂë Dim bEmpty(1 To 2) As Byte, bPass(1 To 2) As Byte Dim I As Integer, Password As String ' ´ò¿ªÒ»¸ö¿ÕÊý¾Ý¿â×÷Ϊ²ÎÕÕ Open "D:\VB6_Test\MDB_Password\New_Empty_DB.mdb" For Binary As #1 ' ´ò¿ª±»ÃÜÂë±£»¤µÄÊý¾Ý¿â Open "D:\VB6_Test\MDB_Password\Pass_Protected_DB.mdb" For Binary As #2 Seek #1, Offset Seek #2, Offset For I = 1 To 20 ' Access 2000 Êý¾Ý¿âÃÜÂë×ÔÊÐí20λ Get #1, , bEmpty ' ÆäÖÐÿλÃÜÂëÕ¼Á½¸ö×Ö½Ú Get #2, , bPass ' Ò»¸öºº×ÖÒ²½öÊÇһλÃÜÂ룬ռÁ½¸ö×Ö½Ú If (bEmpty(1) Xor bPass(1)) <> 0 Then Password = Password + Chr(bEmpty(1) Xor bPass(1)) ' ½«ÃÜÂë½âÃÜ End If Next Close 1, 2 MsgBox "Password:" + Password ' ÏÔʾÃÜÂë End Sub ÏÂͼÏÔʾÁË Access 2000µÄÃÜÂ뽨Á¢ÒÔ¼°±»ÉÏÊö³ÌÐòÆƽâºóµÄÇé¿ö£º Ò»¡¢ÉîÈë·ÖÎö ÉÏÊö³ÌÐò³É¹¦µÄ¹Ø¼üÊÇʹÓÃÁËÒ»¸ö¿ÕÊý¾Ý¿â£¨New_Empty_DB.mdb£©¡£¸ÃÊý¾Ý¿âµÄ´´½¨ÈÕÆÚ±ØÐëÓë±»ÃÜÂë±£»¤µÄÊý¾Ý¿â£¨Pass_Protected_DB.mdb£©ÏàÒ»Ö¡£ »»¾ä»°Ëµ£¬Access 2000 ½ö½öÊÇʹÓá°Êý¾Ý¿â´´½¨ÈÕÆÚ¡±À´¼ÓÃÜÓû§ÃÜÂë¡£ ÏÂͼÊÇÔÚ Windows×ÊÔ´¹ÜÀíÆ÷ÖлñÈ¡¡°´´½¨ÈÕÆÚ¡±µÄʾÀý£º ӦעÒâµÄÊÇ£ºÉÏÃæµÄ¡°´´½¨ÈÕÆÚ¡±Ö»ÊDzÙ×÷ϵͳ¼¶µÄ£¬Ò²¾ÍÊÇ Windows¼Ç¼ÔÚÎļþ¼ÐĿ¼ÀïµÄÐÅÏ¢£¨¸ù¾ÝÎļþÃûµÄ³¤¶Ì£¬Ã¿¸öÎļþÔÚĿ¼ÀïÕ¼ÓÃÖÁÉÙ32¸ö×Ö½Ú£¬°üÀ¨£ºÎļþÃû¡¢ÊôÐÔ¡¢Îļþ´óС¡¢Ê×ÝýºÅ¡¢´´½¨Ê±¼ä¡¢ÐÞ¸Äʱ¼äºÍ·ÃÎÊʱ¼äµÈ£©¡£ Access 2000 ÔÚÊý¾Ý¿âÖÐÒ²¼Ç¼Á˸ÃÊý¾Ý¿âµÄ¡°´´½¨ÈÕÆÚ¡±¡£¼ÓÃÜÊý¾Ý¿âÃÜÂëµÄÕýÊÇÊý¾Ý¿âÄÚ²¿¼Ç¼µÄÕâ¸ö¡°´´½¨ÈÕÆÚ¡±¡£¸ÃÈÕÆÚÖ»ÓÐÔÚÊý¾Ý¿â±»³É¹¦´ò¿ªºó²ÅÄÜ¿´µ½¡£µ«ÔÚÒ»°ãÇé¿öÏ£¬²Ù×÷ϵͳ¼¶µÄÒÔ¼°Êý¾Ý¿âÄÚ±£´æµÄ¡°´´½¨ÈÕÆÚ¡±ÊÇÍêÈ«Ò»ÑùµÄ£¬Òò´ËÕâΪÆÆÒëÕßÌṩÁË·½±ã¡£ ÉÏÊö³ÌÐòÖл¹ÓÐÒ»µãÐèҪ˵Ã÷£ºÎª¼òÃ÷Æð¼û£¬½âÃÜÃÜÂëʱ½ö´¦ÀíÁËË«×Ö½ÚµÄÊ××Ö½Ú£¬Òò´ËËü½ö¶Ô·Çºº×ÖÃÜÂëÓÐЧ¡£ÈôÒª½âÃܺº×ÖÃÜÂ룬Ðë¶ÔË«×Ö½Ú¾ù×ö´¦Àí¡£ ¶þ¡¢·À·¶´ëÊ© 1¡¢Òþ²Ø¡°´´½¨ÈÕÆÚ¡± ´ÓÉÏÃæµÄ·ÖÎö¿ÉÒÔ¿´³ö£¬¼ÈÈ»¡°´´½¨ÈÕÆÚ¡±ÊÇÆÆÒëµÄ¹Ø¼ü£¬ÄÇôÎÒÃÇÓ¦¡°¶ÔÖ¢ÏÂÒ©¡±£¬½«ÕæʵµÄ¡°´´½¨ÈÕÆÚ¡±Òþ²ØÆðÀ´¡£ µÚÒ»²½£¬´´½¨Êý¾Ý¿âʱ£¬Ê¹ÓÃÒ»¸ö¡°²»¿É˼ÒéµÄ¡¢±ðÈ˲»Òײ²⡱µÄÈÕÆÚ¡£×ö·¨Îª£ºÐÞ¸Ä WindowsϵͳÈÕÆÚ£¬ÀýÈç¸ÄΪ2026Äê05ÔÂ15ÈÕ£¬´´½¨Êý¾Ý¿âºóÔÙ½«ÏµÍ³ÈÕÆڸĻء£Õâ¸ö¡°²»¿É˼Ò顱µÄÈÕÆÚ¼´Îª¸ÃÊý¾Ý¿âµÄÕæʵ¡°´´½¨ÈÕÆÚ¡±¡£ µÚ¶þ²½£¬Ð޸IJÙ×÷ϵͳ¼¶µÄ¡°´´½¨ÈÕÆÚ¡±¡£ÉÏÊöµÚÒ»²½Íê³Éºó£¬¸ÃÊý¾Ý¿âÔÚ²Ù×÷ϵͳ¼¶µÄ´´½¨ÈÕÆÚÒ²ÊÇ2026Äê05ÔÂ15ÈÕ£¬±ØÐë¼ÓÒÔÐ޸ģ¬ÒÔ´ïµ½Òþ²ØÕæʵ´´½¨ÈÕÆÚµÄÄ¿µÄ¡£Ð޸IJÙ×÷ϵͳ¼¶µÄ¡°´´½¨ÈÕÆÚ¡±¿ÉÒÔÓÉÏÂÃæµÄ³ÌÐò¶þÍê³É¡£ ¡¡ ' ³ÌÐò¶þ£¨VB6£©£ºÐÞ¸ÄÎļþÔÚ²Ù×÷ϵͳ¼¶µÄ¡°´´½¨ÈÕÆÚ¡± Private Type FILETIME dwLowDateTime As Long dwHighDateTime As Long End Type Private Type SYSTEMTIME wYear As Integer wMonth As Integer wDayOfWeek As Integer wDay As Integer wHour As Integer wMinute As Integer wSecond As Integer wMilliseconds As Integer End Type Private Const GENERIC_WRITE = &H40000000; Private Const OPEN_EXISTING = 3 Private Const FILE_SHARE_READ = &H1; Private Const FILE_SHARE_WRITE = &H2; Private Declare Function SetFileTimeWrite Lib "kernel32" Alias _ "SetFileTime" (ByVal hFile As Long, lpCreateTime As FILETIME, _ ByVal NullP As Long, ByVal NullP2 As Long) As Long Private Declare Function SystemTimeToFileTime Lib "kernel32" _ (lpSystemTime As SYSTEMTIME, lpFileTime As FILETIME) As Long Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" _ (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal _ dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal _ dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, _ ByVal hTemplateFile As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) _ As Long Private Declare Function LocalFileTimeToFileTime Lib "kernel32" _ (lpLocalFileTime As FILETIME, lpFileTime As FILETIME) As Long Private Sub Command1_Click() Dim Year As Integer, Month As Integer, Day As Integer Dim Hour As Integer, Minute As Integer, Second As Integer Dim TimeStamp As Variant, Filename As String, X As Integer Year = 2001: Month = 3: Day = 13 ' ×¼±¸É趨µÄ¡°´´½¨ÈÕÆÚ¡± Hour = 12: Minute = 0: Second = 26 TimeStamp = DateSerial(Year, Month, Day) + TimeSerial(Hour, Minute, Second) Filename = "D:\VB6_Test\MDB_Password\Pass_Protected_DB.mdb" ' Ä¿±êÎļþÃû X = ModifyFileStamp(Filename, TimeStamp) End Sub Function ModifyFileStamp(Filename As String, TimeStamp As Variant) As Integer Dim X As Long, Handle As Long, System_Time As SYSTEMTIME Dim File_Time As FILETIME, Local_Time As FILETIME System_Time.wYear = Year(TimeStamp): System_Time.wMonth = Month(TimeStamp) System_Time.wDay = Day(TimeStamp) System_Time.wDayOfWeek = Weekday(TimeStamp) - 1 System_Time.wHour = Hour(TimeStamp): System_Time.wSecond = Second(TimeStamp) System_Time.wMilliseconds = 0 X = SystemTimeToFileTime(System_Time, Local_Time) X = LocalFileTimeToFileTime(Local_Time, File_Time) ' ת»»³É¿ÉÓõÄÀàÐÍ Handle = CreateFile(Filename, GENERIC_WRITE, FILE_SHARE_READ Or _ FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, 0, 0) ' ´ò¿ªÎļþ X = SetFileTimeWrite(Handle, File_Time, ByVal 0&, ByVal 0&) ' ÉèÖÃÈÕÆÚ CloseHandle Handle ' ¹Ø±ÕÎļþ End Function ͼÈýÏÔʾµÄÊÇÊý¾Ý¿âµÄÕæʵ¡°´´½¨ÈÕÆÚ¡±ÒÔ¼°¾³ÌÐò¶þαװµÄ²Ù×÷ϵͳ¼¶µÄ¡°¼ÙÏó¡±ÈÕÆÚ¡£ ¿ÉÒÔ¿´³ö£¬Òþ²Ø¡°´´½¨ÈÕÆÚ¡±µÄ·½·¨¶ÔÆÆÒëÕßÀ´ËµÖ»ÊÇÔö´óÁËÆÆÒëµÄ¹¤×÷Á¿£¬Ôö¼ÓÁËÆƽâÊÔÑéµÄ´ÎÊý¡£Ö»Óн«¸Ã·½·¨ÓëÏÂÊöµÄ¡°·½·¨¶þ¡±Ïà½áºÏ£¬²ÅÄÜ´ïµ½¡°¼ÈÖαêÓÖÖα¾¡±µÄЧ¹û¡£²»¹ýÔÚÒ»°ãµÄÇé¿öÏ¡°·½·¨Ò»¡±Òѹ»Óã¬ÒòΪÈç¹ûÆÆÒëÕßÆðʼʹÓõIJâÊÔÈÕÆÚÓë×îÖÕµÄÕæʵÈÕÆÚÏà²î°ÙÄ꣬ËûÐèÒª¸¶³öÊýÍò´ÎµÄŬÁ¦£¡ 2¡¢Ê¹ÓÃÓû§¼¶°²È«»úÖÆ Í¨¹ýÉèÖò»Í¬µÄÓû§ÕʺźÍ×éÕʺŶÔÊý¾Ý¿âÖеĸ÷ÖÖ×ÊÔ´½øÐÐȨÏÞ¹ÜÀí¡£ÕâÖÖ¼ÓÇ¿Á˵ݲȫ»úÖÆËäÈ»¸øÈÕ³£Ê¹Óã¨ÓÈÆäÊǵ¥Óû§Ê¹Óã©´øÀ´Á˲»±ã£¬µ«ÔÚÓа²È«Òþ»¼µÄµØ·½ÒÀÈ»ÓÐÉèÖõıØÒª¡£ ÉèÖø÷ÖÖÕʺż°ÏàӦȨÏ޵ļòµ¥·½·¨ÊÇʹÓá°ÉèÖð²È«»úÖÆÏòµ¼¡±£¨¼ûͼËÄ£©¡£Í¼ËÄ»¹ÏÔʾÁË°²È«»úÖÆÆô¶¯ºóÒªÇóÓû§µÇ¼µÄ»Ãæ¡£ Èý¡¢½áÂÛ Ëùν¡°µÀ¸ßÒ»³ßħ¸ßÒ»ÕÉ¡±£¬ÒòΪÕâÊÀÉϲ¢Ã»Óоø¶ÔµÄ°²È«¡£ÉÏÊö·½·¨Ò»µÄÄ¿µÄÊÇÌá¸ßÆÆÒëµÄ³É±¾ÒÔ´ïµ½³£ÈËÄÑÒÔ½ÓÊܵij̶ȣ»¶ø·½·¨¶þµÄ³õÖÔÊÇÔö¼ÓÃÜÂëµÄÊýÁ¿¡£Á½ÖÖ·½·¨µÄ½áºÏ×ãÒÔʹÆÆÒëÕßÍû¶øÈ´²½¡£²»¹ýÕâ²¢²»Òâζ×Å°Ù·ÖÖ®°ÙµÄ°²È«¡£µ«´Ó˼ÏëÉÏÌá¸ß°²È«Òâʶ£¬·À»¼ÓÚδȻ£¬Õâ±Ï¾¹ÊÇÕýÈ·µÄÑ¡Ôñ¡£
--------------------------------------------------------------------------------
Ïà¹ØÎÄÕÂ
ÆƽâAccess(*.mdb)Ä¿Ç°ËùÓа汾µÄÃÜÂë 2003-11-17 11:31:05
Access 2000Êý¾Ý¿âµÄÃÜÂëÍüÁËÔõô°ì 2003-11-13 11:05:39
ÈçºÎ½â³ýVBAProject µÄ¿ÚÁî±£»¤ 2003-11-13 10:56:38
|