当前位置:网站首页>C language implementation setting desktop wallpaper
C language implementation setting desktop wallpaper
2022-06-11 00:56:00 【Star and dream_ dream】
Key code :
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\\Users\\star-dream\\Pictures\\Saved Pictures\\1.jpg", SPIF_SENDCHANGE|SPIF_UPDATEINIFILE);
More information , Please refer to Baidu Encyclopedia
Today's main character is : How to use C Language implementation desktop wallpaper
The function prototype :
BOOL SystemParametersInfo(UINT uiAction,UINT uiParam,PVOID pvParam,UINT fWinlni);Parameter description :
- uiAction: This parameter specifies the system-level parameters to query or set .
- uiParam:uiParam All is in the parameter specification ulParam Are all errors .( The general values 0)
- pvParam: Related to system parameters that are queried or set .( If wallpaper is set , Just fill in the picture address )
- fWinlni: If system parameters are set , It is used to specify whether to update the user profile .( Value 0 Or any item in the table below )
SPIF_UPDATEINIFILE Writes the new system parameter Settings to the user profile . SPIF_SENDCHANGE Broadcast after updating the user profile WM_SETTINGCHANGE news .
SystemParametersInfo Function has 4 Parameters , Mainly for :( Corresponding to the function prototype )
- SPI_SETDESKWALLPAPER: Set desktop wallpaper .
- The first 2 Parameters are general Set to 0, that will do .
- The first 3 Fill in parameters Where the picture is located
- The first 4 Two parameters can fill 0, perhaps SPIF_UPDATEINIFILE | SPIF_SENDCHANGE
Code example ( For reference only )
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
void menu()
{
printf("----------------------\n");
printf("| 1. Cherry blossoms |\n");
printf("| 2. Exquisite |\n");
printf("| 3. scenery |\n");
printf("| 4. loop |\n");
printf("----------------------\n");
}
int main()
{
int choice = 0;
int count = 10;
menu();
printf(" Please enter the option :");
scanf("%d",&choice);
switch(choice)
{
case 1:
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\\Users\\star-dream\\Pictures\\Saved Pictures\\1.jpg", SPIF_SENDCHANGE|SPIF_UPDATEINIFILE);
break;
case 2:
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\\Users\\star-dream\\Pictures\\Saved Pictures\\2.jpg", SPIF_SENDCHANGE|SPIF_UPDATEINIFILE);
break;
case 3:
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\\Users\\star-dream\\Pictures\\Saved Pictures\\3.png", SPIF_SENDCHANGE|SPIF_UPDATEINIFILE);
break;
case 4:
while(count)
{
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\\Users\\star-dream\\Pictures\\Saved Pictures\\1.jpg", SPIF_SENDCHANGE|SPIF_UPDATEINIFILE);
Sleep(2000);
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\\Users\\star-dream\\Pictures\\Saved Pictures\\2.jpg", SPIF_SENDCHANGE|SPIF_UPDATEINIFILE);
Sleep(2000);
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\\Users\\star-dream\\Pictures\\Saved Pictures\\3.png", SPIF_SENDCHANGE|SPIF_UPDATEINIFILE);
Sleep(2000);
count--;
}
break;
}
return 0;
}Saved picture location :

边栏推荐
- WIN11卸载小组件
- What is the difference between hubs, switches and routers?
- Detailed explanation of five types of load balancing principle scenarios
- B 树的简单认识
- 大厂是面对深度分页问题是如何解决的(通俗易懂)
- What are absolute and relative paths, and what are their advantages and disadvantages?
- oracle带xy字段值的关系表同步到pg数据库转为几何字段
- 扎实的基础知识+正确的方法是快速阅读源码的关键
- 对象作为点(Objects as Points) 个人总结
- Deploy netron services through kubernetes and specify model files at startup
猜你喜欢
![[network counting] 1.4 network delay, packet loss and throughput](/img/a8/74a1b44ce4d8b0b1a85043a091a91d.jpg)
[network counting] 1.4 network delay, packet loss and throughput

Complete uninstallation of MySQL under Linux

AQS explanation of concurrent programming

Synchronized keyword for concurrent programming

Kubeflow 1.2.0 installation
![[network planning] 3.2 transport layer - UDP: connectionless service](/img/a8/74a1b44ce4d8b0b1a85043a091a91d.jpg)
[network planning] 3.2 transport layer - UDP: connectionless service

Introduction and basic construction of kubernetes

MESI cache consistency protocol for concurrent programming

招聘 | 南京 | TRIOSTUDIO 三厘社 – 室内设计师 / 施工图深化设计师 / 装置/产品设计师 / 实习生等

SLAM卡尔曼滤波&&非线性优化
随机推荐
How to solve the deep paging problem in large factories (easy to understand)
QT thread and interface
Golang中的深拷贝与浅拷贝
Optimization of startup under SYSTEMd, deleting useless SYSTEMd services
Detailed explanation of five types of load balancing principle scenarios
Complete uninstallation of MySQL under Linux
自动化测试系列
项目连接不到远程虚拟机The driver has not received any packets from the server.
The principle and source code interpretation of executor thread pool in concurrent programming
微信小程序实现OCR扫描识别
Décomposition détaillée du problème de chemin le plus court du graphique
DeepStream系列之鱼眼相机测试
Pirate OJ 148 String inversion
Qt线程与界面
浅谈有赞搜索质量保障体系 v2021
WIN11卸载小组件
Wechat applet to realize OCR scanning recognition
RPC details
compiler explorer
Slam Kalman filter & nonlinear optimization
