在C#中使用桌面的最佳方式是什么? [英] What is a best way to work with desktop in C#

查看:83
本文介绍了在C#中使用桌面的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在开始研究我的项目,但我需要知道以哪种方式移动。在我的项目中,我需要一直关注Dektop并注意桌面上是否有我感兴趣的内容,例如我已经启动了我的程序而不是我在互联网上做的事情。我希望每次在桌面上出现Facebook徽标时都会抛出Messagebox。



我尝试了什么:



我有两个想法如何做到这一点。一种方法是在程序运行时制作屏幕截图,而不是在每个scrennshot寻找Facebook徽标,但我被告知,长时间进行此类操作对处理器来说是不利的。另一种方法是使用AForge框架,但我不知道如何。所以,如果有人有另一个想法请告诉我。

Hello guys, I am starting working on my Project but I need know in which way to move. In my Project I need to watch over the Dektop all the time and notice if something interesting for me have appeared on Desktop , for example I have launched my Program and than I am just doing something in Internet. I want to throw Messagebox every time when on Desktop appears Facebook logo.

What I have tried:

I have two ideas how to do that. One way is to make a screenshots while Program runs and than in every scrennshot look for Facebook logo but I was told that making such operations long time is bad for Processor. Another way is to use AForge Framework but I I did not understand how. So if someone have another Idea please say it to me.

推荐答案

我不确定你的问题是否在谈论用户Windows桌面上的项目。但如果你是这样的话会告诉你桌面上是否有一个快捷图标:



I'm not sure from your question if you are talking about an item on the user's Windows desktop. But if you are, something like this will tell you if there is a shortcut icon placed on the desktop:

bool foundFacebook = false;
var desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var files = Directory.GetFiles(desktop);
foreach (var file in files)
{
    var fileName = Path.GetFileName(file).ToLower();
    foundFacebook |= fileName.Contains("facebook");
}


这篇关于在C#中使用桌面的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆