Exemple #1
0
        public void ShowNoActivate()
        {
            int screenWidth  = Screen.PrimaryScreen.WorkingArea.Width;
            int screenHeight = Screen.PrimaryScreen.WorkingArea.Height;

            this.Left = screenWidth - this.Width;
            this.Top  = screenHeight - this.Height;

            Configuration c;

            c = ConfigurationHelper.GetConfiguration(ConfigurationKey.PlaySoundOnReminder);
            if (Convert.ToInt32(c.Value) == 1)
            {
                System.Media.SystemSounds.Asterisk.Play();
            }

            this.timer.Start();

            //// Show the window without activating it.
            APIsUser32.ShowWindow(this.Handle, APIsEnums.ShowWindowStyles.SHOWNOACTIVATE);

            //// Equivalent to setting TopMost = true, except don't activate the window.
            APIsUser32.SetWindowPos(this.Handle, HWND_TOPMOST, Left, Top, Width, Height, 10);
            //SetWindowPos((int)this.Handle, 0, Left, Top, Width, Height, System.Convert.ToUInt16(SWP.FRAMECHANGED | SWP.NOACTIVATE | SWP.NOCOPYBITS | SWP.NOMOVE | SWP.NOOWNERZORDER | SWP.NOSENDCHANGING | SWP.NOSIZE | SWP.NOZORDER));
        }
Exemple #2
0
 protected override void SetVisibleCore(bool value)
 {
     if (value)
     {
         APIsUser32.ShowWindow(this.Handle, APIsEnums.ShowWindowStyles.SHOWNOACTIVATE);
     }
     else
     {
         base.SetVisibleCore(value);
     }
 }