From 2ad1a531b8fb3154b03d6e4cad1bc3e57bf6c5df Mon Sep 17 00:00:00 2001 From: szporowolik Date: Sun, 20 Oct 2019 13:40:53 +0200 Subject: [PATCH] Removed NativeMethods - not used as we allow multiple instances now; changed tray icon hover text --- .../Perun_v1/01_Classes/NativeMethods.cs | 13 ------------- .../Perun_v1/02_Forms/form_Main.Designer.cs | 1 - 02_Windows_App/Perun_v1/02_Forms/form_Main.cs | 14 ++++---------- 02_Windows_App/Perun_v1/Perun_v1.csproj | 1 - 4 files changed, 4 insertions(+), 25 deletions(-) delete mode 100644 02_Windows_App/Perun_v1/01_Classes/NativeMethods.cs diff --git a/02_Windows_App/Perun_v1/01_Classes/NativeMethods.cs b/02_Windows_App/Perun_v1/01_Classes/NativeMethods.cs deleted file mode 100644 index 6815b57..0000000 --- a/02_Windows_App/Perun_v1/01_Classes/NativeMethods.cs +++ /dev/null @@ -1,13 +0,0 @@ -// This class just wraps some Win32 stuff that we're going to use for blocking of multiple instances -using System; -using System.Runtime.InteropServices; - -internal class NativeMethods -{ - public const int HWND_BROADCAST = 0xffff; - public static readonly int WM_SHOWME = RegisterWindowMessage("WM_SHOWME"); - [DllImport("user32")] - public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam); - [DllImport("user32")] - public static extern int RegisterWindowMessage(string message); -} \ No newline at end of file diff --git a/02_Windows_App/Perun_v1/02_Forms/form_Main.Designer.cs b/02_Windows_App/Perun_v1/02_Forms/form_Main.Designer.cs index c1ad029..001bbc7 100644 --- a/02_Windows_App/Perun_v1/02_Forms/form_Main.Designer.cs +++ b/02_Windows_App/Perun_v1/02_Forms/form_Main.Designer.cs @@ -497,7 +497,6 @@ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; - this.MinimizeBox = false; this.Name = "form_Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Perun for DCS World"; diff --git a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs index 2d099c6..fb4fe1f 100644 --- a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs +++ b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs @@ -187,6 +187,9 @@ namespace Perun_v1 // Set title bar this.Text = "[#"+ con_txt_dcs_instance.Text + "] " + Globals.strPerunTitleText; + + // Set notification icon text + trayIconMain.Text = this.Text; } private void con_Button_Listen_OFF_Click(object sender, EventArgs e) @@ -232,6 +235,7 @@ namespace Perun_v1 // Set title bar this.Text = Globals.strPerunTitleText; + trayIconMain.Text = this.Text; // Set globals Globals.intInstanceId = 0; @@ -300,16 +304,6 @@ namespace Perun_v1 } } - protected override void WndProc(ref Message m) - { - // Try to run of 2nd instance - if (m.Msg == NativeMethods.WM_SHOWME) - { - form_Main_BringFromTray(); - } - base.WndProc(ref m); - } - private void form_Main_SendToTray() { // Sends app to system tray diff --git a/02_Windows_App/Perun_v1/Perun_v1.csproj b/02_Windows_App/Perun_v1/Perun_v1.csproj index efcb591..346de2f 100644 --- a/02_Windows_App/Perun_v1/Perun_v1.csproj +++ b/02_Windows_App/Perun_v1/Perun_v1.csproj @@ -129,7 +129,6 @@ - Form