开发者

How can we change the background of the desktop via filing?

开发者 https://www.devze.com 2023-01-18 11:34 出处:网络
Iwish to change the background of my computer by doing filing in C language but 开发者_Python百科I dont have any idea how to proceed in this regard.Please guide me to the files i must open and what ch

I wish to change the background of my computer by doing filing in C language but 开发者_Python百科I dont have any idea how to proceed in this regard.Please guide me to the files i must open and what changes must i do to them


That is highly OS specific and so not worth the effort to do it in C because for each environment you support you will have to do a lot of code but of course, it's up to you to choose.

In linux you have several tools available and you can look at their source-code. I believe it even depends on the type of graphic environment you're in. For gnome there is gconftool-2, for KDE you have to look yourself but it's easy to find. For linux it would be wiser to do a system call like:

char str[] = "gconftool-2 -t str --set /desktop/gnome/background/picture_filename /path_to_your/pic.png"; // adapt it
system(str);

instead of writing code from scratch.

For windows there is a very short batch script here that should be easy to convert: batch - change background. To do it in C you write the strings to a text file with the extension .reg then do a system call to apply it.

For Mac OS it's different too, so you have to be more specific

0

精彩评论

暂无评论...
验证码 换一张
取 消