I'm rather new to VB and programming in general, and I could use a little guidance. I was able to build my application the way I want it but I just need one more piece.
Is there a way to launch a particular form in my project from a desktop shortcut?
There are 5 forms in the tray application, and I would like to be able to launch one in particular from a desktop shortcut.
Is that possible? If so, where would I start?
Thanks in advance!
What I have tried:
I have not been able to find anything specific to my question, and that could be due to incorrect phrasing...
I found some code (On CodeProject I believe) as seen below. It is a form-less tray application which is what I think I wanted. As for the Timer, I wasn't sure I needed that and it works fine without it.?.?
Here is the module code I am using. How would I fit this answer into my code? [Remember... I'm a NOOB! (as much as I hate to admit it)]
<pre>Imports Microsoft.Win32
Module Module1
Private MyNotifyIcon As NotifyIcon
Private MyContextMenu As ContextMenu
Private WithEvents Tray As NotifyIcon
Public Sub Main()
Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", Application.ProductName, Application.ExecutablePath, RegistryValueKind.String)
MyNotifyIcon = New NotifyIcon
MyContextMenu = New ContextMenu
MyNotifyIcon.Icon = My.Resources.ecmsi
MyNotifyIcon.Visible = True
MyContextMenu.MenuItems.Add("&Support Ticket", AddressOf Ticket)
MyContextMenu.MenuItems.Add("Quick Self-Help", AddressOf SelfHelp)
MyContextMenu.MenuItems.Add("Instant Support", AddressOf Support)
MyContextMenu.MenuItems.Add("System Information", AddressOf SysInfo)
MyContextMenu.MenuItems.Add("-")
MyContextMenu.MenuItems.Add("About", AddressOf About)
If (Control.ModifierKeys = Keys.Shift) Then
MyContextMenu.MenuItems.Add("Tools", AddressOf Tools)
End If
MyNotifyIcon.ContextMenu = MyContextMenu
Application.Run()
End Sub
Private Sub ExitApplication(ByVal sender As Object, ByVal e As EventArgs)
MyContextMenu.Dispose()
MyNotifyIcon.Dispose()
Application.Exit()
End Sub
Private Sub SysInfo(ByVal sender As Object, ByVal e As EventArgs)
Dim SysInfo As New formSysInfo
SysInfo.Show()
End Sub
Private Sub SelfHelp(ByVal sender As Object, ByVal e As EventArgs)
Dim Tools As New formTools
formTools.Show()
End Sub
Private Sub Support(ByVal sender As Object, ByVal e As EventArgs)
Process.Start("https://weblink.com")
End Sub
Private Sub Ticket(ByVal sender As Object, ByVal e As EventArgs)
Dim Ticket As New formTicket
formTicket.Show()
End Sub
Private Sub Tray_DoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseButtons)
formTicket.Show()
End Sub
Private Sub ECMSI_Tray_DBLClk(sender As Object, e As EventArgs) Handles ECMSI_Tray.DoubleClick
formTicket.Show()
End Sub
Private Sub About(ByVal sender As Object, ByVal e As EventArgs)
Dim About As New formAbout
formAbout.Show()
End Sub
Private Sub Tools(ByVal sender As Object, ByVal e As EventArgs)
Process.Start("C:\DIR1\DIR2\App.exe")
End Sub
End Module