'*********************** Code Start *************************** ' Const JDS_DSN_name = "MDTS" ' DSN的名字 Const JDS_Server_name = "148.154.61.15" ' 服务器名,这里给出的服务器的IP地址, ' 也可以通过域名解析给出域名 ' 定义注册表API函数 Private Declare Function RegEnumKeyEx Lib "advapi32.dll" _ Alias "RegEnumKeyExA" _ (ByVal hKey As Long, _ ByVal dwIndex As Long, _ ByVal lpName As String, _ lpcbName As Long, _ ByVal lpReserved As Long, _ ByVal lpClass As String, _ lpcbClass As Long, _ ByVal lpftLastWriteTime As String) As Long Private Declare Function RegOpenKeyEx Lib "advapi32.dll" _ Private Declare Function RegCloseKey Lib "advapi32.dll" _ Const HKEY_LOCAL_MACHINE = &H80000002 Const ERROR_SUCCESS = 0& Const REG_DWORD = 4
' 查看我们要的系统数据源(DSN)是否存在。 syscmdresult = SysCmd(acSysCmdSetStatus, "查找系统DSN: " & JDS_DSN_name & " ...") If lngResult <> ERROR_SUCCESS Then lngCurIdx = 0 lngResult = RegEnumKeyEx(lngKeyHandle, _ If lngResult = ERROR_SUCCESS Then Loop While lngResult = ERROR_SUCCESS And Not DSNfound If Not DSNfound Then End If End Function |
翻译: 朱亦文
来 源 于:MVPS: The access Web