# Windows Process in tray, run at startup



## FredT (Nov 16, 2007)

Hi,

I'm fairly new to programming... I've been doing web stuff for a while, but I'm just getting into desktop programming. I'm using C with the Win32 API to create a few little test applications.

I am curious how Windows processes work and how I might get a program to run constantly in the background out of the system tray. I want the program to start up when the user turns the computer on (ideally through the registry, not the startup folder) and show up in the tray for the user to click on and bring up the GUI whenever they want. Meanwhile, the program must be running so it can manage a timer or something so it will display a window/run a process every so often.

I've searched all over for solutions to these problems, but I really haven't been able to find a clear answer. Maybe this is beyond my level for now, but I'm curious to see how this works.

I hope this makes sense!

Thanks :grin:


----------



## jamiemac2005 (Jul 5, 2007)

Hey, personally i don't have a clue about the system tray functions but i'd assume it's a windows library somewhere that handles that. After having searched i can't find a thing about it in C (Only C# etc.) but this may be of use to you http://www.codeproject.com/KB/shell/systemtray.aspx

Anyway, the registry keys concerning startup programs are:
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
- HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

(And then "RunOnce" rather than "Run" for programs designed to only run on the next startup). You can find these values in msconfig looking at the "location" field of a startup item.

As for the running in the background you could take a look at this: http://www.codeproject.com/KB/shell/trayicons.aspx which describes how to minimise programs to the system tray.

I hope i was of any use.

Cheers,
Jamey


----------



## Skie (Mar 15, 2003)

Another option, if you don't want to mess with the registry is to add a shortcut to the Start menu. However, with this method it's easier for a user to delete the shortcut and thereby stopping your program from running at start up.


----------



## FredT (Nov 16, 2007)

Thanks guys!


----------

