Archived

This topic is now archived and is closed to further replies.

windows registry stuff

This topic is 6284 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey I need to get the desktop background to use in my game, so I need to read the registry for the HKEY_CURRENT_USER\Control Panel\Desktop\wallpaper key, so I think I need to use the RegQueryInfoKey function, but I can''t figure out how to read the data... How would I read the data into a regular string so I can use it to open the bmp?

Share this post


Link to post
Share on other sites
Pseudo-pseudo-code from memory:



LPTSTR lpName = new TCHAR[256];
DWORD cbName = 256 * sizeof(TCHAR);

RegCreateKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\Desktop"), &hkKey);
RegQueryValueEx(hkKey, _T("wallpaper"), (LPVOID)lpName, &cbName);
RegCloseKey(hkKey);



There are params to the functions to figure out key type and security, I omitted those because I don't remember their exact order and they really aren't too important for reading a single value.

Edited by - JonStelly on October 3, 2000 11:56:02 AM

Share this post


Link to post
Share on other sites
Thanks for replying but I just can''t get this to work, when I print the string I just get a long |||||||||||||||| thing so I guess it''s not working, any ideas?

Share this post


Link to post
Share on other sites