Windows SDK Registry: How can I read in data from the registry?

来源:互联网 发布:贵阳大数据案例 编辑:程序博客网 时间:2024/04/29 23:06

Q: How can I read data from the registry?
A:
Code:

 

Q: The RegQueryValueEx function returns an error code 234 (ERROR_MORE_DATA) that means "more data is available". How many bytes must be allocated for value buffer to assure this error does not appear anymore?
A: To find the necessary buffer size, call 'RegQueryValueEx()' with a 'NULL' value in 'lpData' parameter. After return, the variable pointed by 'lpcbData' will contain the size of the data. Allocate the buffer 'lpData' then call 'RegQueryValueEx()' again:
Code:

原文出处:http://www.codeguru.com/forum/showthread.php?s=&threadid=247020

原创粉丝点击