I have the following code that allows my console app to go to the tray with an icon:
Sub Main()
Dim tray As New NotifyIcon()
tray.Icon = My.Resources.phoneIcon
tray.Text = "Left Click to show console window"
tray.Visible = True
AddHandler tray.Click, AddressOf iconClicked
ShowWindow(int, False)
System.Windows.Forms.Application.Run()
End Sub
Private Sub iconClicked(ByVal sender As Object, ByVal e As EventArgs)
if mouseLeft then
ShowWindow(int, True)
else
ShowWindow(int, False)
end if
End Sub
It also allows the console to be brought back up when left-clicking on the tray icon. The problem is, I need to be able to right-click to take it back down.
How can I use the ByVal e As EventArgs or ByVal sender As Object to detect which mouse button is pressed?