Hello! I'm creating a basic program to change my desktop wallpaper via a random seed and SystemParametersInfo() and I'm having some issues. The function appears to execute without error, yet it does not reset my background. Any thoughts?
I have made one interesting observation. Sometimes it will reset the background to black, and other times it will simply keep the previous background. I've also experimented with other formats other than .jpg and that makes no difference.
The MSDN entry for SystemParametersInfo makes not comments about limitations of SystemParametersInfoA. Like all (or at least most) -A functions, it no doubt just converts all strings from ANSI to Unicode and then calls the corresponding -W function.
You could convert your code to work with Unicode literals, wstring, wstringstream (or better, wostringstream), etc. and the -W versions of the functions.
For this application I think I'll just stick to the (PVOID) cast of the c_str() since I'm only developing this for personal use. Though if I do decide to utilize Unicode functions, that's very good to know!
Though one thing does worry me a bit. It appears my linker does not like CoTaskMemFree(pidl), which is a little odd. I have included windows.h, which should also include Objbase.h. Which library would I need to link to in order to utilize this function? I'm currently using Dev-C++ 22.214.171.124.
[Linker error] undefined reference to `CoTaskMemFree@4'
Nope! Though I will once I reinstall Dev-C++. It appears, accessing the project options makes the entire IDE crash now.. interesting. I reinstalled/updated and everything appears to be working fine now.
Thanks anyways! Now to bury my head into some more code..