473,406 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Run program in sys tray

I'm trying to get my program to run in the system tray.
I've looked at dozend of tutorials on the web and on newsgroups but I
just dont get it!

Has anyone got any links or example code that could use?

I'm using Microsoft Visual Basic 2005 Express Edition.

Thanks in advance.

Casper.

Nov 21 '05 #1
5 2617
"Casper" <ca********@msn.com> schrieb:
I'm trying to get my program to run in the system tray.
I've looked at dozend of tutorials on the web and on newsgroups but I
just dont get it!

Has anyone got any links or example code that could use?

Take a look at the toolbox. You'll find a NotifyIcon component on the
"Windows Forms" tab which you can drag onto the form. Assign an icon to its
'Icon' property and set its 'Visible' property to 'True'. This will show
the icon in the taskbar's notification area.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
Thanks Herfried. I didnt know it would be THAT easy!

OK, I've got my Icon showing in the sys tray. When the program loads I
want it to minimize to the tray and not to be in the task bar. On the
icon I've got to buttons: Open and Exit. When you click open I want it
to open the form and show in the task bar, and when you click exit I
want the program to quit. How would I go about doing this?

Casper

Nov 21 '05 #3
That makes life easy!

"Casper" <ca********@msn.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Thanks Herfried. I didnt know it would be THAT easy!

OK, I've got my Icon showing in the sys tray. When the program loads I
want it to minimize to the tray and not to be in the task bar. On the
icon I've got to buttons: Open and Exit. When you click open I want it
to open the form and show in the task bar, and when you click exit I
want the program to quit. How would I go about doing this?

Casper

Nov 21 '05 #4
Casper,
In addition to the other comments.

It sounds like you used a Form as the startup object of your project, which
you hide, to allow having a NotifyIcon in the system tray. Correct?

Matthew MacDonald's book "Microsoft Visual Basic .NET Programmer's Cookbook"
has a topic on creating a system tray program.

Basically: Rather than using a Form as the startup object, use a Component
instead.

Create a new Component class (use Project - Add Component). Add a NotifyIcon
to the component designer. Also add a ContextMenu object for the
NotifyIcon. When you click the menu, create and show the form. Remember to
put an Exit option on the menu.

Make the Component the startup object, adding a Shared Sub Main to the
component.

Public Class Component1
Inherits System.ComponentModel.Component

' Component designer generated code omitted.

Public Shared Sub Main
Dim app as New Component1
Application.Run()
End Sub

Private Sub menuOptions_Click(...) Handles menuOptions.Click
' this would be your settings dialog.
Dim dialog as New OptionsDialog
dialog.ShowDialog()
dialog.Dispose()
End Sub

Private Sub menuExit_Click(...) Handles menuExit.Click
Me.Dispose()
Application.Exit()
End Sub

End Sub

The problem is you cannot edit the menu from the Component Designer. What I
do is use cut & paste from a Form Designer onto the Component Designer to
get the menu to the component...

The call to Me.Dispose enables the icon to be removed from the system tray
right away rather then waiting.

Hope this helps
Jay
"Casper" <ca********@msn.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Thanks Herfried. I didnt know it would be THAT easy!

OK, I've got my Icon showing in the sys tray. When the program loads I
want it to minimize to the tray and not to be in the task bar. On the
icon I've got to buttons: Open and Exit. When you click open I want it
to open the form and show in the task bar, and when you click exit I
want the program to quit. How would I go about doing this?

Casper

Nov 21 '05 #5
Casper,

Maybe is it better when you think that your question is a 2005 product
related. To help the developers from Microsoft 2005 by asking this question
next time in one of the newsgroups

http://communities.microsoft.com/new...idbey&slcid=us

Cor
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ulysses | last post by:
hi, I'm working in python 5 months. I think it's very cool language. I do a p2p python program GUI. First I make a software by wxpython. But I find wxpython use many many memory. Second I use...
5
by: Phil Galey | last post by:
VB.NET 2002 on Windows 2000 SP 3 When I start my program, the NotifyIcon appears in the tray, as it should. However, when I close the program, the NotifyIcon remains until I hover over it with...
2
by: Tony Ciconte | last post by:
We have developed an Acc97 application and distribute it using the Wise installation system and SageKey scripts. The installations are rock solid and the product works well on all types of systems....
1
by: siliconpiNOSPAM | last post by:
Hi, I have a C# test program (setup as a console application) that runs a bunch of other programs like IE / etc. I run this program from a command window, the other windows cover the command...
1
by: Kevin White | last post by:
Hi all, I have a program that has this basic flow: 1- Splash screen opens and creates a system tray icon (the splash screen is the main form that is started on program execution, and stays...
4
by: Robert Samuel White | last post by:
Hi there. Can anyone point me to some good references or examples on how to create an independent tray program that can send triggers to external applications all designed inside the same...
1
by: Ranjan as usual | last post by:
Dear folks, I just completed an autoresponder program. My program should be constantly running to monitor the folder of exchange server, but I just don't want to minimize it in my test box. Is there...
5
by: scottt | last post by:
I asked a question along a similar line about a week ago and didn't get any replies. Let me try to ask the quetion again a little bit different to see if I can get some help on this problem. Is...
0
by: mutyalarao | last post by:
Hi, I am trying a simple window program in C#. That application should be in system tray and show the window when the icon in the tray is clicked. How can i do this?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.