如何使用VC ++更改桌面背景 [英] How to change desktop background using VC++
问题描述
我当前正在尝试使用SystemParametersInfo()
来更改桌面背景,但在键入内容时却没有给我任何错误,但是在运行程序时,我收到带有黄色三角形的警告,并说那里是在KernelBase.dll中引发的某种异常,然后说尚未加载某些PDB。我很久以前就这样做了,并且能够使它正常工作,但我不记得有人能再帮我什么了?这是我写的
I am currently trying to change my desktop background using SystemParametersInfo() vs doesnt give me any errors when I type my stuff in but when I run the program I get this warning with the yellow triangle and it says there was some kind of exception thrown at KernelBase.dll and then it says that some PDB has not been loaded. I did this a long time ago and was able to get it to work but i dont remember how anymore can anyone help me out? here is what I have written
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:/Windows/Downloaded Program Files/Flowers.jpg", SPIF_UPDATEINIFILE);
有人知道为什么会这样以及如何解决吗?感谢您的任何帮助,谢谢
does anyone know why this is happening and how to fix it? Any help is appreciated, thanks
推荐答案
您需要在 L
中添加文件路径。 L C:/ Windows / Downloaded Program Files / Flowers.jpg
。
You need to add L
to the file path. L"C:/Windows/Downloaded Program Files/Flowers.jpg"
.
#include "stdafx.h"
#include <windows.h>
int main() {
int return_value = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, L"d:/flower1.jpg", SPIF_UPDATEINIFILE);
return 0;
}
这篇关于如何使用VC ++更改桌面背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!