01.
02.
03.
04.
Const
HKEY_LOCAL_MACHINE = &H80000002
05.
Const
adVarChar = 200
06.
07.
Dim
ErrorMessage
08.
09.
Set
objRegistry = GetObject(
"Winmgmts:root\default:StdRegProv"
)
10.
11.
strPath =
"SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers"
12.
bRet = WMIRegEnumValues( HKEY_LOCAL_MACHINE, strPath, aNames, aTypes )
13.
14.
if not bRet then
15.
Wscript.Echo ErrorMessage
16.
Wscript.Quit
17.
end if
18.
19.
Set
Rs = CreateObject(
"ADODB.Recordset"
)
20.
Rs.Fields.Append
"ソートキー"
, adVarChar,255
21.
Rs.Open
22.
23.
For
Each
data
In
aNames
24.
25.
Rs.AddNew
26.
Rs.Fields(
"ソートキー"
).value = data
27.
28.
Next
29.
30.
Rs.Sort =
"ソートキー"
31.
Rs.MoveFirst
32.
33.
Do
while not Rs.EOF
34.
35.
Wscript.Echo Rs.Fields(
"ソートキー"
).value &
""
36.
37.
Rs.MoveNext
38.
39.
Loop
40.
41.
Rs.Close
42.
43.
44.
45.
46.
47.
Function
WMIRegEnumValues ( nType, strPath, aNames, aTypes )
48.
WMIRegEnumValues =
False
49.
50.
on error resume next
51.
WMIRet = objRegistry.EnumValues( nType, strPath, aNames, aTypes )
52.
if Err.Number <> 0 then
53.
ErrorMessage = Err.Description
54.
Exit
Function
55.
end if
56.
if WMIRet <> 0 then
57.
ErrorMessage = Hex( WMIRet )
58.
Exit
Function
59.
end if
60.
on error goto 0
61.
62.
WMIRegEnumValues =
True
63.
End
Function