版权声明: 可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息。
以获取Microsoft .Net Framework版本为例,在OnBegin中获取:
1 function OnBegin()
2 LIST listID;
3 STRING nzItem, szSubKey;
4 NUMBER nReturn, nItem;
5 LIST listSubKeys, listNames;
6 STRING szMsg;
7 begin
8 // Create the lists to hold values returned by RegDBQueryKey.
9 listSubKeys = ListCreate(STRINGLIST);
10 listNames = ListCreate(STRINGLIST);
11
12 if ((listNames = LIST_NULL) || (listSubKeys = LIST_NULL)) then
13 MessageBox ("Unable to create necessary lists.", SEVERE);
14 abort;
15 endif;
16
17 RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
18 szSubKey = "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP";
19 nReturn = RegDBQueryKey ( szSubKey, REGDB_KEYS, listSubKeys );
20 if (nReturn < 0) then
21 MessageBox("First call to RegDBQueryKey failed.", SEVERE);
22 else
23 szMsg = "Subkeys under " + szSubKey + " key:";
24 SdShowInfoList("RegDBQueryKey Example", szMsg, listSubKeys );
25 endif;
26
27 // Remove the lists from memory.
28 ListDestroy (listNames);
29 ListDestroy (listSubKeys );
30 end;
2 LIST listID;
3 STRING nzItem, szSubKey;
4 NUMBER nReturn, nItem;
5 LIST listSubKeys, listNames;
6 STRING szMsg;
7 begin
8 // Create the lists to hold values returned by RegDBQueryKey.
9 listSubKeys = ListCreate(STRINGLIST);
10 listNames = ListCreate(STRINGLIST);
11
12 if ((listNames = LIST_NULL) || (listSubKeys = LIST_NULL)) then
13 MessageBox ("Unable to create necessary lists.", SEVERE);
14 abort;
15 endif;
16
17 RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
18 szSubKey = "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP";
19 nReturn = RegDBQueryKey ( szSubKey, REGDB_KEYS, listSubKeys );
20 if (nReturn < 0) then
21 MessageBox("First call to RegDBQueryKey failed.", SEVERE);
22 else
23 szMsg = "Subkeys under " + szSubKey + " key:";
24 SdShowInfoList("RegDBQueryKey Example", szMsg, listSubKeys );
25 endif;
26
27 // Remove the lists from memory.
28 ListDestroy (listNames);
29 ListDestroy (listSubKeys );
30 end;