简体   繁体   中英

Display a C# Form to another user, or all logged-on users

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.

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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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