Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I want to start the application before user login to the system.
it's an system tray application.
please help me out.

Thanks in advance.
Posted

You cannot do it with the tray application as such applications can be loaded when a tray is available; and this happens after a user logs in. However, you can do it automatically. And, frankly, running a system tray application makes no sense when nobody is logged in. Why using it when there is no tray?

There are several ways of running applications automatically on different phases of system load and user's log in. The simplest and least robust way is "Startup" sub-menu under the system's main menu. This menu is on per-user basis but items can also be added to the "All Users" data.

Other methods are prescribed in the system Registry.

You can consider keys like:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run			


For more information, I recommend my "secret weapon": Sysinternals AutoRuns utility. Download Sysinternals Suite: http://technet.microsoft.com/en-us/sysinternals/bb842062[^] (must-have anyway!), unpack AutoRuns and run it. Browse all folders and read help. This is the ultimate source of all places where applications and other components could be run automatically.

—SA
 
Share this answer
 
v2
Comments
Richard MacCutchan 14-Jul-11 5:02am    
5 for another excellent answer; it helped me too.
Sergey Alexandrovich Kryukov 14-Jul-11 5:09am    
Thank you, Richard. Do you mean Sysinternals?
--SA
Richard MacCutchan 14-Jul-11 5:34am    
No, I meant everything you wrote. I have used SysInternals in the past and agree it's a great resource, but my compliment was strictly for you.
Sergey Alexandrovich Kryukov 14-Jul-11 14:55pm    
I'm flattered. :-) Thank you again, Richard.
--SA
Espen Harlinn 14-Jul-11 14:53pm    
Nice reply, my 5
Applications with a UI can only be run inside a User session. You might consider developing a Windows Service that can run even if no user is logged in. Here are some examples that might help you get started:

C# Sample[^]

VB.NET Sample[^]
 
Share this answer
 
Comments
Richard MacCutchan 14-Jul-11 5:03am    
Good answer, have a (positive) vote.
[no name] 14-Jul-11 15:07pm    
Thanks Richard :-)
Espen Harlinn 14-Jul-11 14:51pm    
Right, my 5
[no name] 14-Jul-11 15:07pm    
Thanks Espen :-)
Kim Togo 14-Jul-11 18:26pm    
Good answer. My 5.
If I were developing this, I would write a Windows service that performed the functionality that I wanted to run even if the user was not logged in. Then, I would use the tray application to interrogate the service to get whatever status I needed to be displayed to the user, as this only needs to run when the user logs in. As an added bonus, the tray application would also be able to notify the user if the service was running or not (and possibly provide an option for the user to start the service).

You will typically see this type of behaviour in anti-virus applications.
 
Share this answer
 
Comments
Kim Togo 14-Jul-11 18:31pm    
Good answer and good advice. My 5.
thatraja 14-Jul-11 22:21pm    
Nice advice, 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900