还通过注册表的。相关代码如下: Private Declare Function HtmlHelp Lib "HHCtrl.ocx" Alias "HtmlHelpA" (ByVal hwndCaller As Long, ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As String) As Long Declare Function RegDeleteKeyA Lib "advapi32.dll" (ByVal hKey As Long, ByVal sSubKey As String) As Long Declare Function RegOpenKeyA Lib "advapi32.dll" (ByVal hKey As Long, ByVal sSubKey As String, ByRef hkeyResult As Long) As Long Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Declare Function RegSetValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal sValueName As String, ByVal dwReserved As Long, ByVal dwType As Long, ByVal sValue As String, ByVal dwSize As Long) As Long Declare Function RegCreateKeyA Lib "advapi32.dll" (ByVal hKey As Long, ByVal sSubKey As String, ByRef hkeyResult As Long) As Long Declare Function RegQueryValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal sValueName As String, ByVal dwReserved As Long, ByRef lValueType As Long, ByVal sValue As String, ByRef lResultLen As Long) As Long Public Const RK As String = "HKEY_CURRENT_USER" Public Const P As String = "Software\Microsoft\RegSoftware\{WINNER868-SIMON868-W868-XIN868}\" Public Const KeyName As String = "FileType" Public Const KeyValue As String = "NO" Public Const Demo As Long = 210 Function GetRegistry(Key, Path, ByVal ValueName As String) Dim hKey As Long, lValueType As Long, sResult As String, lResultLen As Long, ResultLen As Long, x, TheKey As Long TheKey = &H80000001 If RegOpenKeyA(TheKey, Path, hKey) <> 0 Then x = RegCreateKeyA(TheKey, Path, hKey) sResult = Space(100) lResultLen = 100 x = RegQueryValueExA(hKey, ValueName, 0, lValueType, sResult, lResultLen) If x = 0 Then GetRegistry = Left(sResult, lResultLen - 1) Else GetRegistry = "Not Found" RegCloseKey hKey End Function Function WriteRegistry(ByVal Key As String, ByVal Path As String, ByVal entry As String, ByVal value As String) Dim hKey As Long, lValueType As Long, sResult As String, lResultLen As Long, TheKey, x TheKey = &H80000001 If RegOpenKeyA(TheKey, Path, hKey) <> 0 Then x = RegCreateKeyA(TheKey, Path, hKey) x = RegSetValueExA(hKey, entry, 0, 1, value, Len(value) + 1) WriteRegistry = (x = 0) End Function
|