windows registry stuff

Started by
2 comments, last by Cafall 23 years, 6 months ago
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?
Advertisement
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
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?
http://workspot.net/~kondor/tutors/windows/registry.html

This topic is closed to new replies.

Advertisement