Public Function lujing() Dim hKey As Long Dim subkey As Long Dim lens As Long Dim ret As Long ret = RegOpenKey(HKEY_CURRENT_USER, "Software\BiTcomet", hKey) If ret = 0 Then ret = RegQueryValue(hKey, subkey, "", lens) End If lujing = ret RegCloseKey hKey End Function 这样写对不? 可以返回路径的不?
'SetStringValue "HKEY_LOCAL_MACHINE", "String Value", "Hello Visual Basic programmer"'SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Internat", "internat.exe"'新建二进制值
'SetBinaryValue "HKEY_LOCAL_MACHINE", "Binary Value", Chr$(&H1) + Chr$(&H2) + Chr$(&H3) + Chr$(&H4)'新建 DWORD 值
'SetDWORDValue "HKEY_LOCAL_MACHINE", "DWORD Value", "1"'读取串值
'GetStringValue("HKEY_LOCAL_MACHINE", "String Value")'读取二进制值
'GetBinaryValue("HKEY_LOCAL_MACHINE", "Binary Value")
'If rtn = Chr$(&H1) + Chr$(&H2) + Chr$(&H3) + Chr$(&H4) Then'读取 DWORD 值
'GetDWORDValue("HKEY_LOCAL_MACHINE", "DWORD Value")'删除键值
'DelValue("HKEY_LOCAL_MACHINE", "String Value")'新建主键
'CreateKey "HKEY_LOCAL_MACHINE\Registry Editor"'删除主键
'DeleteKey "HKEY_LOCAL_MACHINE\Registry Editor"
最好是直接用ini文件读写,存在文件目录下!
如果是通过文件关联查找程序,比如找到打开.jpg文件的程序。方法就是
1、读取注册表 HKEY_CLASSES_ROOT\扩展名 的默认值
HKEY_CLASSES_ROOT\.jpg
如果是ACDsee程序结果就是 “ACDC_JPG”
2、读取程序命令行HKEY_CLASSES_ROOT\类型\shell\Open\Command
类型就是1中读出来的字符串:
HKEY_CLASSES_ROOT\ACDC_JPG\shell\Open\Command
这样就得到了
"F:\XXX\ACDsee32绿色注册版\ACDSEE32.EXE" /v
程序就被找到
楼主要找的是BT程序,这种程序在注册表中也是有固定的位置
刚发的文件共享,客户端就是这样子打开文件的。
Dim hKey As Long
Dim subkey As Long
Dim lens As Long
Dim ret As Long
ret = RegOpenKey(HKEY_CURRENT_USER, "Software\BiTcomet", hKey)
If ret = 0 Then
ret = RegQueryValue(hKey, subkey, "", lens)
End If
lujing = ret
RegCloseKey hKey
End Function
这样写对不? 可以返回路径的不?