I write a joker program that will change desktop image:
In one of the lines of the code an error occurred:
SystemParametersInfo (SPI_SetDeskwallpaper, 0, "sr2.jpg", spif_updateinifile | spif_sendchange);
In the third argument, the compiler swears to the fact that it is impossible to convert Const Char * to Pvoid. It seems I missed something somewhere. What can the problem be?
Answer 1, Authority 100%
Formally SystemparametersInfo
function can change the data to which the third parameter indicates, once this is not a pointer to const
.
So formally you should do this:
char fn [] = "sr2.jpg";
SystemParametersInfo (SPI_SetDeskwallpaper, 0, Fn, SPIF_UPDATEINIFILE | SPIF_SendChange);
But, frankly, I doubt that he will be might, so I think in practice you can do with the type of
SystemParametersInfo (SPI_SETDESKWALLPAPER, 0, PVOID ("SR2.JPG"), spif_updateinifile | spif_sendchange);
But I did not say that! 🙂