-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathReadingOptions.prg
More file actions
85 lines (69 loc) · 2.22 KB
/
ReadingOptions.prg
File metadata and controls
85 lines (69 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
* Program Name : ReadingOptions.Prg
* Article No. : [Win API] - 014
* Illustrate : ?????? VFP 6.0 ???
* Date / Time : 2001.09.10
* Writer :
* 1st Post :
* My Comment : ??????????????
#Define ERROR_SUCCESS 0
#Define KEY_READ 131097
#Define KEY_ALL_ACCESS 983103
#Define HKEY_CURRENT_USER 2147483649 && 0x80000001
Do decl
hBaseKey = 0
* lcBaseKey = "Software\Microsoft\VisualFoxPro\3.0\Options"
* lcBaseKey = "Software\Microsoft\VisualFoxPro\5.0\Options"
* lcBaseKey = "Software\Microsoft\VisualFoxPro\6.0\Options"
* lcBaseKey = "Software\Microsoft\VisualFoxPro\7.0\Options"
lcBaseKey = "Software\Microsoft\VisualFoxPro\9.0\Options"
* try this option too
* lcBaseKey = "Software\ODBC\ODBC.INI\ODBC Data Sources"
If RegOpenKeyEx (HKEY_CURRENT_USER, lcBaseKey,;
0, KEY_ALL_ACCESS, @hBaseKey) <> ERROR_SUCCESS
? "Error opening registry key"
Return
Endif
Create CURSOR cs (valuename cs(50), valuevalue cs(200))
dwIndex = 0
Do WHILE .T.
lnValueLen = 250
lcValueName = Repli(Chr(0), lnValueLen)
lnType = 0
lnDataLen = 250
lcData = Repli(Chr(0), lnDataLen)
lnResult = RegEnumValue (hBaseKey, dwIndex,;
@lcValueName, @lnValueLen, 0,;
@lnType, @lcData, @lnDataLen)
* for this case on return the type of data (lnType)
* is always equal to 1 (REG_SZ)
* that means null-terminated string
If lnResult <> ERROR_SUCCESS
Exit
Endif
lcValueName = Left (lcValueName, lnValueLen)
lcData = Left (lcData, lnDataLen-1)
Insert INTO cs VALUES (lcValueName, lcData)
dwIndex = dwIndex + 1
Enddo
= RegCloseKey (hBaseKey)
Select cs
Index ON valuename TAG valuename
Go TOP
Brow NORMAL NOWAIT
Procedure decl
Declare INTEGER RegCloseKey IN advapi32 INTEGER hKey
Declare INTEGER RegOpenKeyEx IN advapi32;
INTEGER hKey,;
STRING lpSubKey,;
INTEGER ulOptions,;
INTEGER samDesired,;
INTEGER @ phkResult
Declare INTEGER RegEnumValue IN advapi32;
INTEGER hKey,;
INTEGER dwIndex,;
STRING @ lpValueName,;
INTEGER @ lpcValueName,;
INTEGER lpReserved,;
INTEGER @ lpType,;
STRING @ lpData,;
INTEGER @ lpcbData