application running in background and icon shown on the taskbar

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anybody provide an example of how to program an application that can run
in the background and show only the icon on the taskbar?
 
Michael Yao said:
Can anybody provide an example of how to program an application that can
run
in the background and show only the icon on the taskbar?

Well, it's quite easy to get an application to run in the background. You
simply choose to display no windows. If by "icon in the taskbar" you mean
the half-size ones that appear near the clock, you ask the shell to put one
there. Explorer provides the Shell_NotifyIcon() function to manipulate the
icon's in its tray.

There is a sample here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/html/vcsmptraynot.asp

It is an unmanaged sample (i.e. native C++). If you are looking for an
example under .Net, just so say and someone will probably point you in the
right direction.

Regards,
Will
 
If you want to go the .NET Windows Forms Application route:
- Set FormBorderStyle to FixedToolWindow. (no alt-tab)
- Set ShowInTaskbar to false
- Set Opacity to 0% and WindowState to Minimized (without opacity 0%, you'll
see the minimzed window)
- Add a notifyIcon to the form, set its icon, and add some sort of
application exiting ability to it.
 
James said:
If you want to go the .NET Windows Forms Application route:
- Set FormBorderStyle to FixedToolWindow. (no alt-tab)
- Set ShowInTaskbar to false
- Set Opacity to 0% and WindowState to Minimized (without opacity 0%, you'll
see the minimzed window)
- Add a notifyIcon to the form, set its icon, and add some sort of
application exiting ability to it.


What if we make the thread in which the form is used (presumably the main thread) a
background thread (by setting the IsBackground property to true)? Will this change again,
if we select the window while running?
 
Back
Top