diff --git a/Outlook2013TodoAddIn/Forms/NewMailAlert.Designer.cs b/Outlook2013TodoAddIn/Forms/NewMailAlert.Designer.cs
index 5c23079..d89457c 100644
--- a/Outlook2013TodoAddIn/Forms/NewMailAlert.Designer.cs
+++ b/Outlook2013TodoAddIn/Forms/NewMailAlert.Designer.cs
@@ -100,7 +100,7 @@
this.lnkSender.AutoSize = true;
this.lnkSender.Location = new System.Drawing.Point(85, 5);
this.lnkSender.Name = "lnkSender";
- this.lnkSender.Size = new System.Drawing.Size(82, 17);
+ this.lnkSender.Size = new System.Drawing.Size(72, 17);
this.lnkSender.TabIndex = 10;
this.lnkSender.TabStop = true;
this.lnkSender.Text = "linkLabel1";
@@ -137,7 +137,6 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "NewMailAlert";
- this.TopMost = true;
this.ResumeLayout(false);
this.PerformLayout();
diff --git a/Outlook2013TodoAddIn/Forms/NewMailAlert.cs b/Outlook2013TodoAddIn/Forms/NewMailAlert.cs
index 6f97aa6..8eb84bf 100644
--- a/Outlook2013TodoAddIn/Forms/NewMailAlert.cs
+++ b/Outlook2013TodoAddIn/Forms/NewMailAlert.cs
@@ -12,7 +12,7 @@ using System.Windows.Forms;
namespace Outlook2013TodoAddIn.Forms
{
///
- /// New form to display new emai lnotifications
+ /// New form to display new email notifications
///
public partial class NewMailAlert : Form
{
@@ -29,14 +29,9 @@ namespace Outlook2013TodoAddIn.Forms
private bool mouseIsOver = false;
///
- /// Show form
+ /// Topmost value
///
- private const int SW_SHOW = 5;
-
- ///
- /// Fading effect
- ///
- private const uint AW_BLEND = 0x00080000;
+ private const int WS_EX_TOPMOST = 0x00000008;
#endregion "Variables"
@@ -55,6 +50,21 @@ namespace Outlook2013TodoAddIn.Forms
get { return true; }
}
+ ///
+ /// This is used so we can show without activation and be the TopMost form
+ /// The TopMost property of the form MUST be set to false for this to work
+ /// https://connect.microsoft.com/VisualStudio/feedback/details/401311/showwithoutactivation-is-not-supported-with-topmost
+ ///
+ protected override CreateParams CreateParams
+ {
+ get
+ {
+ CreateParams value = base.CreateParams;
+ value.ExStyle |= WS_EX_TOPMOST;
+ return value;
+ }
+ }
+
#endregion "Properties"
#region "Methods"
@@ -79,37 +89,6 @@ namespace Outlook2013TodoAddIn.Forms
timer.Start();
}
- ///
- /// Load and bring to fron
- ///
- /// EventArgs
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- if (this.WindowState == FormWindowState.Minimized)
- {
- this.WindowState = FormWindowState.Normal;
- }
- this.BringToFront();
- }
-
- [DllImport("user32.dll")]
- private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
-
- [DllImport("user32.dll")]
- private static extern bool AnimateWindow(IntPtr hWnd, uint dwTime, uint dwFlags);
-
- ///
- /// Method to display the form and make it topmost
- ///
- /// True or false
- public bool ShowPopup()
- {
- bool result = ShowWindow(this.Handle, SW_SHOW);
- //bool result = AnimateWindow(this.Handle, 200, AW_BLEND);
- return result;
- }
-
///
/// Button delete clicked
///
diff --git a/Outlook2013TodoAddIn/ThisAddIn.cs b/Outlook2013TodoAddIn/ThisAddIn.cs
index d1a98ca..4dac8a0 100644
--- a/Outlook2013TodoAddIn/ThisAddIn.cs
+++ b/Outlook2013TodoAddIn/ThisAddIn.cs
@@ -83,7 +83,7 @@ namespace Outlook2013TodoAddIn
NewMailAlert nm = new NewMailAlert(newMail, Properties.Settings.Default.DisplayTimeOut);
// Show the popup without stealing focus
SoundHelper.sndPlaySoundW(SoundHelper.MailBeep, SoundHelper.SND_NODEFAULT);
- nm.ShowPopup();
+ nm.Show();
}
}
}