Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a program when Windows Boots (before Login)

Tags:

c#

.net

I wonder is it possible to run my application before login on windows.? Its actually a WinForm application(Preferably other than Windows service).

I mean my application must be running even before log in and it should sit on System Tray from which I can "show" or open Interface for user.

like image 704
Dark Knight Avatar asked May 05 '11 11:05

Dark Knight


2 Answers

To have:

  • Something happen between system startup and user login
  • An icon in the notification area for users to interact with

You must break your application up into two separate components. One of these will be a WinForms/WPF application which provides the notification area icon and allows the user to interact with it. The other will be a Windows Service, or possibly a scheduled task.

Once you've done this, the windows service can focus on doing whatever needs to be done prior to logon and the notification area application can assume responsibility for showing the results, or whatever else to the end user.

To answer the question you posed in comments regarding reading data from the Event Log, yes this is possible. There are other questions on here which will give you that particular answer:

  • read the windows event log by particular Source
  • Read event log in C#
like image 55
Rob Avatar answered Oct 19 '22 04:10

Rob


This MS article might help but it is a bit old:

http://support.microsoft.com/kb/142905

Hopefully it'll put you on the right tracks though.

like image 27
Russ Clarke Avatar answered Oct 19 '22 03:10

Russ Clarke