有没有一种方法可以使用pinvoke更改锁屏图像(如c#中的墙纸).[DllImport(user32.dll, CharSet = CharSet.Auto)]private static extern Int32 SystemParametersInfo(UInt32 action,UInt32 uParam, string vParam, U...
![](https://oss.womengda.net/imgfile/2310/1ER2JB51240-4B32.jpg)
有没有一种方法可以使用pinvoke更改锁屏图像(如c#中的墙纸).
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SystemParametersInfo(UInt32 action,
UInt32 uParam, string vParam, UInt32 winIni);
private static readonly UInt32 SPI_SETDESKWALLPAPER = 20;
private static UInt32 SPIF_UPDATEINIFILE = 0x1;
private static uint MAX_PATH = 260;
// then I call
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, file, SPIF_UPDATEINIFILE);
我想对锁定屏幕执行相同的操作(例如Bing Desktop应用程序正在执行的操作)
解决方法:
有了Windows 8标签,是的,您可以:
LockScreen.SetImageFileAsync()(如Windows 8 Lock screen personalization sample in C#所示)(省略了错误处理代码,请检查示例):
StorageFile imageFile = await imagePicker.PickSingleFileAsync();
// Application now has access to the picked file, setting image to lockscreen.
// This will fail if the file is an invalid format.
await LockScreen.SetImageFileAsync(imageFile);
沃梦达教程
本文标题为:在C#中更改Windows锁定屏幕背景图片
![](/xwassets/images/pre.png)
![](/xwassets/images/next.png)
猜你喜欢
- 判断一个整数是否是2的N次幂实现方法 2022-11-23
- linux部署.net core WebApi+Nginx反向代理启动Api 2023-09-26
- C#连接Oracle数据库的方法 2023-11-14
- 深入了解c#多线程编程 2023-03-09
- C# API中模型与它们的接口设计详解 2022-12-26
- 解决unity3d导入模型贴图材质丢失的问题 2023-04-14
- C# 获取进程退出代码的实现示例 2023-01-11
- c# 实现网页加载后将页面截取为长图片 2023-03-28
- c# – 如何使用数据库释放WPF 2023-11-13
- C#中FileStream的对比及使用方法 2023-01-28