C#如何在桌面上运行应用程序?

发布于 2024-12-16 12:29:54 字数 233 浏览 0 评论 0原文

是否可以在 Windows 桌面上运行应用程序?我的意思是......它只能在系统托盘中看到,并且它应该能够与桌面一起运行。 我不知道如何编码,请帮助我。我对这些东西有点陌生,我应该创建一些类似“Stardock Fence”。

我看过一些例子,但它们似乎有问题,我可以使用任何强大的替代方案吗?

Is it possible to run applications on the Windows Desktop? I mean... that it can only be seen in the system tray, and it should be able to run alongside the desktop.
I have no idea how to code it, please help me. I'm kind of new to these things, I am supposed to create something like a "Stardock Fence".

I have seen some examples, but they seem buggy, any strong alternative I could use?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

忆悲凉 2024-12-23 12:29:54

Process.Start() 可用于从另一个 win 应用程序启动 Windows 应用程序/控制台应用程序。有些参数还允许您选择隐藏 UI。

Process.Start() can be used to start a windows application/console app from another win application. There are parameters that allow you to optionally hide the UI as well.

梦开始←不甜 2024-12-23 12:29:54

您希望应用程序的窗口始终位于底部。换句话说,您的 UI 将始终显示在任何其他打开的窗口下方和桌面图标上方。

要实现此目的,请参阅这些相关的问题

一旦您的窗口始终位于 z 顺序的底部,您可能需要删除非客户端窗口镶边(标题栏/最小/最大/关闭按钮),以便您的 UI 看起来像一个更集成的部分桌面。周围有很多例子;谷歌搜索留给读者作为练习。

You want your application's windows to be always-on-bottom. In other words, your UI will always appear to be beneath any other open window and just above the Desktop's icons.

To accomplish that, see these related questions.

Once you have a window always on the bottom of the z-order, you'll probably want to remove the non-client window chrome (titlebar/min/max/close buttons) so that your UI can look like a more integrated part of the Desktop. There's plenty of examples around; Googling is left as an exercise for the reader.

高速公鹿 2024-12-23 12:29:54

不完全确定你所说的背景是什么意思。我希望您指的是 Windows 服务,它是 Visual Studio 中的项目类型,或者您可能(更少可能)意味着运行后台线程。

Not entirely sure what you mean by background. I expect you mean a Windows Service which is a project type in visual studio, or you might (less likely) mean running a background thread.

[旋木] 2024-12-23 12:29:54

实际上,如果您希望它出现在系统托盘中,您不希望它完全出现在后台。

如果它完全“在后台”,那么最好的选择是将其作为一项服务。

系统托盘图标需要一个窗口,但您可以将其设置为不可见且非任务栏,这很好。

常见的组合是执行实际繁重工作的服务,以及带有系统托盘图标的隐藏窗口应用程序,该图标报告服务的状态(可能在需要进一步交互时使同一窗口可见)。

Actually, if you want it in the system-tray, you don't want it entirely in the background.

If it was to be fully "in the background", then your best bet is to have it as a service.

System tray icons need a window, but you can just make it non-visible and non-taskbar and that's fine.

A common combo is a service that does the actual heavy-lifting, and a hidden-window application with a systray icon that reports on the service's status (possibly making that same window visible when further interaction is needed).

谈下烟灰 2024-12-23 12:29:54

您想在后台运行您的应用程序吗?是在windows机器上吗?如果是这样,那么您需要考虑将应用程序作为 Windows 服务运行。这是一个 msdn 链接:

Windows 服务简介

我认为文章中有一些例子 - 如果没有的话,这也是一个很好的起点。您可以将服务配置为在计算机启动时自动启动等。然后您的应用程序将在后台运行。

基本上,您可以正常创建应用程序,然后将其托管在 Windows 服务中,而不是控制台应用程序或 winforms 应用程序。

You want to run your application in the background? Is it on a windows machine? If so then you want to look into running your application as a windows service. Here's an msdn link:

Introduction to Windows Services

There's examples in the article I think - if not it's a good starting point. You can configure services to start automatically on startup of the machine etc. Your application will then run in the background.

Basically you craete your application as normal and then host it in a windows service rather than say a console app or a winforms app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文