""
lnResult = 0
BUFFER = SPACE(128)
BufferSize = 128
lnError = RegOpenKeyEx(nReg_MainKeyNo,cReg_sKey, 0, KEY_ALL_ACCESS, @lnResult)
IF lnError = 0
lnType = 0
lnError = RegQueryValueEx(lnResult, cReg_skeyname, 0, @lnType, @BUFFER, @BufferSize)
IF lnError = 0 AND BUFFER <> CHR(0) &&如果错误码为 0, 则正常读取值.
ReturnValue = LEFT(BUFFER, BufferSize - 1) &&取得返回值
ENDIF
ENDIF
=RegCloseKey(lnResult)
RETURN ReturnValue
***********************************
CASE nReg_code=3 &&删除注册表项
skey1=LEFT(cReg_sKey,AT('\',cReg_sKey,OCCURS('\',cReg_sKey))-1)
skey2=SUBST(cReg_sKey,AT('\',cReg_sKey,OCCURS('\',cReg_sKey))+1)
nError =RegOpenKeyEx(nReg_MainKeyNo,sKey1, 0,KEY_ALL_ACCESS, @lnResult)
IF nError#0
MESSAGEBOX('Can`t delete the sub_key!',0+48,'INF')
RETURN .F.
ELSE
nError=RegDeleteKey(lnResult,sKey2)
ENDIF
RETURN nError
ENDCASE
ENDFUNC
上一页 [1] [2]