Application -> start in system tray 
Author Message
 Application -> start in system tray

I used the NotifyIcon class for one small program and everythings works.
Is it possible to launch the application and to show only the icon into the
system tray?
Do I have to make the frmMain invisible or is there a different way to do
it?

TIA



Sun, 30 Jan 2005 08:04:24 GMT  
 Application -> start in system tray
Try this:

Public Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
        Dim MyIcon As New System.Drawing.Icon("YourIconName.ICO") 'Enter a
valid name for an Icon file
        Me.ShowInTaskbar = False
        Me.WindowState = FormWindowState.Minimized
    End Sub

    Private Sub NotifyIcon1_MouseDown(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDown
        Me.WindowState = FormWindowState.Normal

    End Sub

This will load the form, minimize it to the System tray (no taskbar icon)
and restore it when your click on the Systray icon.

Enjoy!


Quote:
> I used the NotifyIcon class for one small program and everythings works.
> Is it possible to launch the application and to show only the icon into
the
> system tray?
> Do I have to make the frmMain invisible or is there a different way to do
> it?

> TIA



Mon, 31 Jan 2005 09:39:56 GMT  
 Application -> start in system tray
Thank you - this works great.

One last question.

I use the following code to send it "back" to the system tray.
----------------------------------------------------------------------------
---

Me.Hide()

ntfInfo.Visible = True

----------------------------------------------------------------------------
---
How can I  hide the form the minimize buttom of the form is clicked?
Or is it better to hide the control?


Quote:
> Try this:

> Public Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
> Handles MyBase.Load
>         Dim MyIcon As New System.Drawing.Icon("YourIconName.ICO") 'Enter a
> valid name for an Icon file
>         Me.ShowInTaskbar = False
>         Me.WindowState = FormWindowState.Minimized
>     End Sub

>     Private Sub NotifyIcon1_MouseDown(ByVal sender As System.Object, ByVal
e
> As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDown
>         Me.WindowState = FormWindowState.Normal

>     End Sub

> This will load the form, minimize it to the System tray (no taskbar icon)
> and restore it when your click on the Systray icon.

> Enjoy!



> > I used the NotifyIcon class for one small program and everythings works.
> > Is it possible to launch the application and to show only the icon into
> the
> > system tray?
> > Do I have to make the frmMain invisible or is there a different way to
do
> > it?

> > TIA



Mon, 31 Jan 2005 10:57:27 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Q: Problems with System Tray functionality in VB5 and question about TaskBar/System Tray

2. starting app in system tray?

3. Starting app minimized in system tray

4. System Tray application

5. How to build an application that sits only in the system tray

6. Minimizing an Application to the System Tray...

7. VB applications and system tray - help!

8. VB applications running in the System Tray?

9. Iconizing application to system tray

10. system tray - modifying icons belonging to other applications

11. activate an application in the system tray

12. Hotkeys from a system tray application

 

 
Powered by phpBB® Forum Software