9 Replies - 5883 Views - Last Post: 02 May 2010 - 02:59 AM Rate Topic: -----

#1 Murgen   User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 06-July 09

Sending Program to System Tray

Posted 01 May 2010 - 07:00 PM

Okay I have written a code to send my program to the system tray when I minimize it. But I am on Windows 7 and I check, and its not there.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Enabled = False
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        AppActivate("SRO_Client")
        SendKeys.Send(TextBox1.Text)
    End Sub

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        e.Cancel = True
        Me.WindowState = FormWindowState.Minimized



    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Me.WindowState = FormWindowState.Normal Or Me.WindowState = FormWindowState.Maximized Then
            show_form.Enabled = False
        ElseIf Me.WindowState = FormWindowState.Minimized Then
            show_form.Enabled = True

        End If
    End Sub

    Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter

    End Sub

    Private Sub Form1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
        If Me.WindowState = FormWindowState.Minimized Then
            Me.ShowInTaskbar = False
            Me.Visible = False

        End If
    End Sub

    Private Sub Form1_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        If Me.WindowState = FormWindowState.Normal Or Me.WindowState = FormWindowState.Maximized Then
            show_form.Enabled = False
        ElseIf Me.WindowState = FormWindowState.Minimized Then
            show_form.Enabled = True

        End If
    End Sub

    Private Sub show_form_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles show_form.Click
        Me.WindowState = FormWindowState.Normal
        Me.ShowInTaskbar = True
        Me.Visible = True

    End Sub

    Private Sub Exit_form_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Exit_form.Click
        Application.Exit()
        Application.DoEvents()


    End Sub
End Class



Can someone help me? Its still running, I go to the processes and it is running the background but does not show up in the system tray.

Is This A Good Question/Topic? 0
  • +

Replies To: Sending Program to System Tray

#2 Damage   User is offline

  • Lord of Schwing
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,989
  • Joined: 05-June 08

Re: Sending Program to System Tray

Posted 01 May 2010 - 07:05 PM

i recall i had a similar issue, in the end it came down to something silly like not having assigned an icon for it i think. Have you done that?
Was This Post Helpful? 0
  • +
  • -

#3 Murgen   User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 06-July 09

Re: Sending Program to System Tray

Posted 01 May 2010 - 07:11 PM

Yeah I have an icon on it unless I have to assign a separate icon for system tray.
Was This Post Helpful? 0
  • +
  • -

#4 CharlieMay   User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1730
  • View blog
  • Posts: 5,709
  • Joined: 25-September 09

Re: Sending Program to System Tray

Posted 01 May 2010 - 07:16 PM

You do know that ShowInTaskbar is not the system tray correct?

Look at the TrayIcon control

Sorry I think it's called NotifyIcon

This post has been edited by CharlieMay: 01 May 2010 - 07:19 PM

Was This Post Helpful? 1
  • +
  • -

#5 Damage   User is offline

  • Lord of Schwing
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,989
  • Joined: 05-June 08

Re: Sending Program to System Tray

Posted 01 May 2010 - 07:18 PM

Just googled it

"Simply add a NotifyIcon control to the form. Use the control's Icon property to determine the icon displayed in the System Tray. Set the control's ContextMenu property to the ContextMenu control that the icon should display when the user right-clicks it. Handle the ContextMenu's events normally. "

http://www.vb-helper..._tray_icon.html
Was This Post Helpful? 1
  • +
  • -

#6 Murgen   User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 06-July 09

Re: Sending Program to System Tray

Posted 01 May 2010 - 07:24 PM

View PostCharlieMay, on 01 May 2010 - 06:16 PM, said:

You do know that ShowInTaskbar is not the system tray correct?

Look at the TrayIcon control

I didn't even realize that ha. TrayIcon Control? You lost me.

View PostDamage, on 01 May 2010 - 06:18 PM, said:

Just googled it

"Simply add a NotifyIcon control to the form. Use the control's Icon property to determine the icon displayed in the System Tray. Set the control's ContextMenu property to the ContextMenu control that the icon should display when the user right-clicks it. Handle the ContextMenu's events normally. "

http://www.vb-helper..._tray_icon.html

Ugh Im so confused that didn't do anything for me

Oh my god It was about the icon -.- I didn't have one set to my NotifyIcon.... I feel so stupid. Thank you everyone
Was This Post Helpful? 0
  • +
  • -

#7 Murgen   User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 06-July 09

Re: Sending Program to System Tray

Posted 01 May 2010 - 07:31 PM

I have one other problem, now its in my system tray, and I have it setup so that I can click it and hit show or exit. I double click, right click, nothing happens and I cannot get the form to show anymore. How do I fix that?
Was This Post Helpful? 0
  • +
  • -

#8 Damage   User is offline

  • Lord of Schwing
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,989
  • Joined: 05-June 08

Re: Sending Program to System Tray

Posted 01 May 2010 - 07:50 PM

Yup, it's the little things that can waste so much time.
Have you added an event to the notifyicon? Double click on it and add some code to maximize your application
Was This Post Helpful? 1
  • +
  • -

#9 Murgen   User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 06-July 09

Re: Sending Program to System Tray

Posted 01 May 2010 - 07:56 PM

View PostDamage, on 01 May 2010 - 06:50 PM, said:

Yup, it's the little things that can waste so much time.
Have you added an event to the notifyicon? Double click on it and add some code to maximize your application

Yeah I got that. Now my ContextMenuStrip will show at the top left of my screen. How do I make it show at the tray by the icon?
Was This Post Helpful? 0
  • +
  • -

#10 _HAWK_   User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1162
  • View blog
  • Posts: 4,444
  • Joined: 02-July 08

Re: Sending Program to System Tray

Posted 02 May 2010 - 02:59 AM

When you add the CMS it will be at the upper left corner in design mode for editing purposes. It will show under your cursor from the system tray.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1