网上代码真不好用!报错,我晕!!

choovy123 2007-08-15 12:18:36
Option Explicit
'等到某一磁盘分区的信息
'运用***.mdb来控制软件的注册
'GetWindowDirectory()返回Windows系统路径字符串的长度,lpBuffer存放系统路径字符串,nsize系统路径字符串的长度
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public sPath As String '用于存放系统目录
Sub Main()
Dim ws As Workspace '工作区
Dim db As Database '数据库
Dim tdf As TableDef '数据表
Dim fld As Field '数据字段
Dim rst As Recordset '数据记录
'*************锁定系统目录************************
Dim PathSize As Long
Dim API_sPath As String * 256 '必需256长
PathSize = GetWindowsDirectory(API_sPath, Len(API_sPath))
sPath = Left$(API_sPath, PathSize) '从字符串API_sPath的左侧开始,取PathSize个字符(去除API_sPath的右侧的空格)
'************更改系统时间,来实现隐藏注册库的修改时间**********
Dim DateTemp
Dim MyDate
Dim TimeTemp
Dim MyTime
MyDate = #8/1/2007#
MyTime = #4:00:00 PM#
DateTemp = Date
TimeTemp = Time
Date = MyDate
Time = MyTime
'****查找是否存在***库,如不存在创建***库,启动注册窗体************
If Dir(sPath & "\***.***") = "" Then
Set ws = DBEngine.Workspaces(0)
Set db = ws.CreateDatabase(sPath & "\***.mdb", dbLangGeneral) 'dbLangGenral是一个常数,用来确定数据驱动程序支持的语言类别
Set tdf = db.CreateTableDef("***")
Set fld = tdf.CreateField("***", dbInteger)
tdf.Fields.Append fld
db.TableDefs.Append tdf
Set db = ws.OpenDatabase(sPath & "\***.mdb")
Set rst = db.OpenRecordset("***")
rst.AddNew
rst.Fields("***") = 0
rst.Update
rst.Close
db.Close
ws.Close
dbEncrypt.dbEncrypt (sPath & "\***.mdb") '加密数据库
'SetAttr sPath & "\***.mdb", vbHidden '更改数据库的属性,当数据库设置为隐藏DIR找不到此文件,因此没有通用性,vbsystem数据库设置为系统文件时因win2k中不存在系统文件属性文件找不到,所以也没用通用性。
Name sPath & "\***.mdb" As sPath & "\***.**" '重命名数据库
frm_zc.Show
Else
'**注册库存在,判断是否已经注册,如已注册启动主窗体,如未注册启动注册窗体**
dbEncrypt.dbExplain (sPath & "\***.***") '数据库解密
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(sPath & "\***.**")
Set rst = db.OpenRecordset("***")
rst.MoveFirst
If rst.Fields("***") = 1 Then
frm_yhdl.Show '启动主窗体
Else
frm_zc.Show '启动注册窗体
End If
rst.Close
db.Close
ws.Close
dbEncrypt.dbEncrypt (sPath & "\***.**") '加密数据库
End If
'********************将时间改会原来时间************************
Date = DateTemp + (Date - MyDate)
Time = TimeTemp + (Time - MyTime)
'**************************************************************
End Sub

网上代码 本想引用,报错""编绎错误,无效限定符."
指针指向 dbEncrypt.dbEncrypt (sPath & "\***.**")
这句话在这里却实有点莫名其妙 dbEncrypt是什么东东??
高手,赐教!
...全文
207 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
嗷嗷叫的老马 2007-08-17
  • 打赏
  • 举报
回复
................................
choovy123 2007-08-17
  • 打赏
  • 举报
回复
能写具体点么,大哥!
of123 2007-08-15
  • 打赏
  • 举报
回复
应该还有一个叫做 dbEncrypt 的类模块。
把有关 dbEncrypt. 的语句都注释掉。然后自己写一个加解密函数,以二进制方式读入数据库源文件,加密后,用密文覆盖源文件;解密则是逆过程。
hui_hui_2007 2007-08-15
  • 打赏
  • 举报
回复
应该是一个加密函数,你要找到源码才行呀

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧