Beispiel #1
0
        /// <summary>
        /// Returns true if the thumbnail was removed from the taskbar; false if it was not.
        /// </summary>
        /// <returns>Returns true if the thumbnail was removed from the taskbar; false if it was not.</returns>
        internal bool OnTabbedThumbnailClosed()
        {
            var closedHandler = TabbedThumbnailClosed;

            if (closedHandler != null)
            {
                var closingEvent = GetTabbedThumbnailClosingEventArgs();

                closedHandler(this, closingEvent);

                if (closingEvent.Cancel)
                {
                    return(false);
                }
            }
            else
            {
                // No one is listening to these events. Forward the message to the main window
                CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.NCDestroy, IntPtr.Zero, IntPtr.Zero);
            }

            // Remove it from the internal list as well as the taskbar
            TaskbarManager.Instance.TabbedThumbnail.RemoveThumbnailPreview(this);
            return(true);
        }
        static internal void SetShieldIcon(System.Windows.Forms.Button Button, bool Show)
        {
            IntPtr fRequired = new IntPtr(Show ? 1 : 0);

            CoreNativeMethods.SendMessage(
                Button.Handle,
                ShellNativeMethods.SetShield,
                IntPtr.Zero,
                fRequired);
        }
Beispiel #3
0
        private int SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages message, int wparam, long lparam)
        {
            // Be sure to at least assert here - messages to invalid handles often just disappear silently
            Debug.Assert(hWndDialog != null, "HWND for dialog is null during SendMessage");

            return((int)CoreNativeMethods.SendMessage(
                       hWndDialog,
                       (uint)message,
                       (IntPtr)wparam,
                       new IntPtr(lparam)));
        }
Beispiel #4
0
 internal void OnTabbedThumbnailActivated()
 {
     if (TabbedThumbnailActivated != null)
     {
         TabbedThumbnailActivated(this, GetTabbedThumbnailEventArgs());
     }
     else
     {
         // No one is listening to these events.
         // Forward the message to the main window
         CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.ActivateApplication, new IntPtr(1), new IntPtr(Thread.CurrentThread.GetHashCode()));
     }
 }
Beispiel #5
0
 internal void OnTabbedThumbnailMinimized()
 {
     if (TabbedThumbnailMinimized != null)
     {
         TabbedThumbnailMinimized(this, GetTabbedThumbnailEventArgs());
     }
     else
     {
         // No one is listening to these events.
         // Forward the message to the main window
         CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.SystemCommand, new IntPtr(TabbedThumbnailNativeMethods.ScMinimize), IntPtr.Zero);
     }
 }
Beispiel #6
0
 internal void OnTabbedThumbnailMoved()
 {
     if (TabbedThumbnailMoved != null)
     {
         TabbedThumbnailMoved(this, GetTabbedThumbnailEventArgs());
     }
     else
     {
         // No one is listening to these events.
         // Forward the message to the main window
         CoreNativeMethods.SendMessage(ParentWindowHandle, TabbedThumbnailNativeMethods.WM_SYSCOMMAND, new IntPtr(TabbedThumbnailNativeMethods.SC_MOVE), IntPtr.Zero);
     }
 }
        private int SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages message, int wparam, long lparam)
        {
            // Be sure to at least assert here -
            // messages to invalid handles often just disappear silently
#pragma warning disable CS8073 // The result of the expression is always 'true' since a value of type 'IntPtr' is never equal to 'null' of type 'IntPtr?'
            Debug.Assert(hWndDialog != null, "HWND for dialog is null during SendMessage");
#pragma warning restore CS8073 // The result of the expression is always 'true' since a value of type 'IntPtr' is never equal to 'null' of type 'IntPtr?'

            return((int)CoreNativeMethods.SendMessage(
                       hWndDialog,
                       (uint)message,
                       (IntPtr)wparam,
                       new IntPtr(lparam)));
        }
        private static string GetNote(System.Windows.Forms.Button Button)
        {
            IntPtr retVal = CoreNativeMethods.SendMessage(
                Button.Handle,
                ShellNativeMethods.GetNoteLength,
                IntPtr.Zero,
                IntPtr.Zero);

            // Add 1 for null terminator, to get the entire string back.
            int           len    = ((int)retVal) + 1;
            StringBuilder strBld = new StringBuilder(len);

            retVal = CoreNativeMethods.SendMessage(Button.Handle, ShellNativeMethods.GetNote, ref len, strBld);
            return(strBld.ToString());
        }
Beispiel #9
0
        internal void OnTabbedThumbnailClosed()
        {
            if (TabbedThumbnailClosed != null)
            {
                TabbedThumbnailClosed(this, GetTabbedThumbnailEventArgs());
            }
            else
            {
                // No one is listening to these events.
                // Forward the message to the main window
                CoreNativeMethods.SendMessage(ParentWindowHandle, TabbedThumbnailNativeMethods.WM_NCDESTROY, IntPtr.Zero, IntPtr.Zero);
            }

            // Remove it from the internal list as well as the taskbar
            TaskbarManager.Instance.TabbedThumbnail.RemoveThumbnailPreview(this);
        }
Beispiel #10
0
 private static void SetNote(System.Windows.Forms.Button button, string text)
 {
     // This call will be ignored on versions earlier than Windows Vista.
     CoreNativeMethods.SendMessage(button.Handle, ShellNativeMethods.SetNote, 0, text);
 }