18.动态改变桌面

 1 #define _CRT_SECURE_NO_WARNINGS
 2 
 3 #include <stdlib.h>
 4 #include <stdio.h>
 5 #include <string.h>
 6 #include <Windows.h>
 7 #include <time.h>
 8 #include <process.h>
 9 using namespace std;
10 
11 void table_pic(void *p)
12 {
13     char path[100];
14     while (1)
15     {
16         for (int i = 1; i <= 6; i++)
17         {
18             sprintf(path, "F:\杂乱test\for\%d.jpg", i);
19             SystemParametersInfo(20,        //20表示更换桌面背景
20                 0,                            //默认的参数0
21                 path,                        //桌面的背景
22                 3);
23             Sleep(3000);
24         }
25     }
26 }
27 
28 void song(void *p)
29 {
30     ShellExecuteA(0, //0表示系统打开
31         "open",        //操作
32         "F:/杂乱test/for/1.mp3",//操作的路径 
33         0, //第四个,第五个都是保留参数,默认都为0
34         0, 
35         0);//0隐藏,1正常,3最大化,6最小化
36 }
37 
38 void main()
39 {
40     _beginthread(table_pic, 0, NULL);
41     _beginthread(song, 0, NULL);
42 
43     system("pause");
44 }
原文地址:https://www.cnblogs.com/xiaochi/p/8168777.html