简体   繁体   English

如何使监控程序显示为壁纸?

[英]How to make a monitoring program appear as wallpaper?

I made a simple C# program to display basic information about some machines we have. 我制作了一个简单的C#程序来显示我们所拥有的一些机器的基本信息。 The program is full screen and refreshed every second. 该程序是全屏的,每秒刷新一次。 We have a dedicated PC and screen in the shop to display it constantly but some directors want it on their PC also, but appears as a wallpaper. 我们在商店里有一个专用的PC和屏幕,可以不断地显示它,但是有些导演也想在PC上使用它,但它看起来像是一个壁纸。

Please tell me if there is an easy way to set a program as a dynamic wallpaper, because I've found nothing. 请告诉我是否有一种简单的方法将程序设置为动态壁纸,因为我什么都没发现。

I think the real solution would be to modify the program so that it runs minimized, and once in a while (like every 15 or 20 minute) it generates a image of the appearance when it is maximized, and then set that picture as the desktop wallpaper. 我认为真正的解决方案是修改程序以使其最小化运行,偶尔(如每15或20分钟)它会在最大化时生成外观图像,然后将该图像设置为桌面墙纸。

Does my solution make sense? 我的解决方案有意义吗? How can I generate a picture from an hidden application? 如何从隐藏的应用程序生成图片?

Your solution makes sense. 你的解决方案很有意义

You can change the background f:om C# with the following code but it only works with .bmp image types: 您可以使用以下代码更改背景f:om C#但它仅适用于.bmp图像类型:

[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SystemParametersInfo(UInt32 uiAction, UInt32 uiParam, String pvParam, UInt32 fWinIni);
private static UInt32 SPI_SETDESKWALLPAPER = 20;
private static UInt32 SPIF_UPDATEINIFILE = 0x1;
private String imageFileName = "c:\\sample.bmp";

public void SetImage( string filename )
{
    SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, filename, SPIF_UPDATEINIFILE);
}

For info on creating a .bmp during runtime, you may read this forum post . 有关在运行时创建.bmp的信息,您可以阅读此论坛帖子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM