Const READ_CONTROL = &H20000 Const STANDARD_RIGHTS_READ = READ_CONTROL Const KEY_QUERY_VALUE = &H1& Const KEY_ENUMERATE_SUB_KEYS = &H8& Const KEY_NOTIFY = &H10& Const KEY_READ = STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY
Dim hKey As Long Dim SubKey, strPath As String Dim lBufferSize As Long Dim rtn As Long, lBuffer As Long, sBuffer As String
Dim FileNo As Integer
'利用添加与删除程序的信息,来找到SuperCapture的安装目录 SubKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall\SuperCapture 3.02_is1" rtn = RegOpenKeyEx(HKEY_LOCAL_MACHINE, SubKey, 0, KEY_READ, hKey) '打开一个主键 If rtn = ERROR_SUCCESS Then 'if the key could be opened then sBuffer = Space(255) 'make a buffer lBufferSize = Len(sBuffer) rtn = RegQueryValueEx(hKey, "Inno Setup: App Path", 0, REG_SZ, sBuffer, lBufferSize) 'get the value from the registry If rtn = ERROR_SUCCESS Then 'if the value could be retreived then