用RegEnumKeyEx()函数枚举注册表子键的问题
使用Windows API 函数RegEnumKeyEx()枚举系统注册表某个子键下面的子键,调用的时候怎么总是不成功。这个函数有8个参数,后面4个参数应该怎样赋值才对?用值传递还是地址传递?参数值给多少才能正确运行?请有经验的大师指点一二,在线急等,谢谢!
程序代码:
DECLARE long RegOpenKeyEx IN Advapi32 long,string@,long,long,long@ DECLARE long RegCloseKey IN Advapi32 long DECLARE long RegQueryInfoKey IN Advapi32 long,long,long,long,long@,long,long,long,long,long,long,long DECLARE long RegEnumKeyEx IN Advapi32 long,long,string@,long@,long,long,long,long hKey = 0 IF RegOpenKeyEx(0x80000001,; && HKEY_CURRENT_USER "SOFTWARE\Microsoft",; 0,; 0x20019,; && KEY_READ @hKey) != 0 && ERROR_SUCCESS RETURN ENDIF cSubKeys = 0 RegQueryInfoKey(hKey,0,0,0,@cSubKeys,0,0,0,0,0,0,0) IF cSubKeys > 0 CREATE CURSOR tt (num I, SubKey C(254)) achKey = REPLICATE(0h00,254) FOR i=1 TO cSubKeys cbName = 254 IF RegEnumKeyEx(hKey,i-1,@achKey,@cbName,0,0,0,0)==0 INSERT INTO tt VALUES (i, LEFT(achKey,cbName)) ENDIF ENDFOR GO TOP BROWSE TITLE "HKEY_CURRENT_USER\SOFTWARE\Microsoft" ENDIF RegCloseKey(hKey)