SIMON-VERMOT Christophe
asked on
Notifyicon and dynamic menu
Hello,
Sorry for my very limited English, i'm french.
Having a concern with a security dll provided by an external company, it responds too slowly in VB.net, 30 to 50 seconds which is unacceptable.
I am trying to create an application that would be hidden at boot time with a notifyicon and a dynamically create menu. This software would be the security management of our other software.
I then need my other software to interoperate the security dll management software, to allow the application to start and retrieve the access levels. (user / super user / admin)
I manage to manage the security part dll. My software recover all the information.
But for now I am trying to overcome two problems:
1) The dynamic creation of the notifyicon and the contextmenustrip. I can create the notifyicon, but the menu does not appear.
2) The dialogue between the 2 software. I found a tutorial to use remoting. It works perfectly, but from a console application, hence the dynamic creation of the notifyicon and contextmenustrip.
I will need a form in my management application. So I tested by creating a form with the notifyicon and the contextmenustrip.
I instantiate the form, without displaying it, and I add a menustrip to my contextMenu, but again I have the icon, but not the menu.
Code below:
Sorry for my very limited English, i'm french.
Having a concern with a security dll provided by an external company, it responds too slowly in VB.net, 30 to 50 seconds which is unacceptable.
I am trying to create an application that would be hidden at boot time with a notifyicon and a dynamically create menu. This software would be the security management of our other software.
I then need my other software to interoperate the security dll management software, to allow the application to start and retrieve the access levels. (user / super user / admin)
I manage to manage the security part dll. My software recover all the information.
But for now I am trying to overcome two problems:
1) The dynamic creation of the notifyicon and the contextmenustrip. I can create the notifyicon, but the menu does not appear.
2) The dialogue between the 2 software. I found a tutorial to use remoting. It works perfectly, but from a console application, hence the dynamic creation of the notifyicon and contextmenustrip.
I will need a form in my management application. So I tested by creating a form with the notifyicon and the contextmenustrip.
I instantiate the form, without displaying it, and I add a menustrip to my contextMenu, but again I have the icon, but not the menu.
Code below:
Public Shared Sub Main(ByVal args() As String)
Try
' Création d'un nouveau canal d'écoute sur le port 1069
Dim channel As TcpChannel = New TcpChannel(1069)
' Enregistrement du canal
ChannelServices.RegisterChannel(channel)
' Démarrage de l'écoute en exposant l'objet en Singleton
RemotingConfiguration.RegisterWellKnownServiceType(GetType(RemoteOperation), "RemoteOperation", WellKnownObjectMode.Singleton)
Console.WriteLine("Le serveur a démarré avec succès")
FormMain = New frmMain
If DetectionLicence(tpSoftWare.WinSparc) = 0 Then
MenuWinsparc = New ToolStripMenuItem
MenuWinsparc.Font = New Font(FontFamily.GenericSerif, 10, FontStyle.Regular)
MenuWinsparc.Text = "WinSparc:" & mProdkey(tpSoftWare.WinSparc) & "|" & mExpireDate(tpSoftWare.WinSparc)
FormMain.ContextMenuStrip1.Items.Add(MenuWinsparc)
End If
FormMain.NotifyIcon1.Visible = True
mtime = New System.Threading.Timer(AddressOf mTimerTick, Nothing, 60000, 60000)
Console.ReadLine()
Catch
Console.WriteLine("Erreur lors du démarrage du serveur")
Console.ReadLine()
End Try
End Sub
Currently I have the console that starts, but in the end it will not console mode.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
MainContext.vb -
Open in new window
MainContext.Designer.vb -Open in new window
Module1.vb -Open in new window
Which produces the following output -You will want to include your own icon embedded resource and change line 24 in MainContext.vb -
Open in new window
-saige-