向其他用户或所有登录用户显示 C# 表单

发布于 2024-09-13 08:22:59 字数 260 浏览 3 评论 0原文

我有一个 C# 控制台应用程序,它每晚从计划任务运行以执行一些维护。该应用程序还显示一个表单作为启动屏幕,通知系统上的任何人该应用程序正在运行,并显示状态。

要使用正确的权限运行应用程序,我需要以另一个用户身份运行计划任务。然而,当我这样做时,应用程序会运行,但登录用户看不到启动屏幕。

我理解这个问题,但不知道如何解决它。有没有办法为其他用户启动表单?或者,有没有办法向所有登录用户显示表单作为通知,类似于“Windows 正在关闭”消息?

感谢您的想法。

I have a C# console application that runs nightly from a Scheduled Task to perform some maintenance. The application also displays a Form as a splash screen informing anyone on the system that the application is running, and shows the status.

To run the application with the correct permissions I need to run the Scheduled Task as another user. When I do this, however, the application runs but the splash screen is not visible to the logged in users.

I understand the issue but am not sure how to work around it. Is there a way to launch a Form for another user? Alternatively, is there a way to display a Form as a notification to all logged in users, similar to a 'Windows is shutting down' message?

Thanks for the ideas.

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

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

发布评论

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

评论(2

归属感 2024-09-20 08:22:59

将您的应用程序转换为始终以“内核模式”运行的服务,独立于登录用户。然后创建一个小型客户端应用程序,该应用程序将在用户登录时始终以“用户模式”运行(每个用户一个实例)。使用进程间通信将“信号”从服务器(服务应用程序)发送到每个客户端(用户应用程序)。

Transform your application to a service that will run all the time in "kernel mode", independently from logged on users. Then create a small client app that will run in "user mode" all the time user is logged on (one instance per each user). Use interprocess communication to send a "signal" from server (service app) to each client (user app).

意中人 2024-09-20 08:22:59

您可以编写另一个小应用程序,并将其放在所有用户启动文件夹中。该应用程序在用户登录时运行,然后隐藏地(或在托盘区域中)坐下并监视指示您的第一个应用程序即将运行的特定触发器。当它看到它们时,它会启动启动屏幕。

You could write another small application, and put it in the All Users startup folder. This app runs when the user logs on, then sits, invisibly (or in the tray area) and watches for specific triggers that indicate that your first app is about to run. When it sees them, it launches the splash screen.

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