コード例 #1
0
// ReSharper disable RedundantAssignment
        /// <summary> Hooks WndProc to react on HOTKEY passed (Alt+Z) </summary>
        private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            handled = false;
            if (msg == (uint)API.WM.HOTKEY)
            {
                handled = true;
                if (BtnStck.IsInstantited && BtnStck.Instance.IsActive)
                {
                    Activate(); //WXP requires this
                    b1.Focus();
                }
                else if (BtnStck.IsInstantited)
                {
                    ShowButtonStack(Keyboard.PrimaryDevice, null);
                }
            }
            if (msg == (int)API.WM.DEVICECHANGE && (handled = DriveManager.HandleDeviceNotification(wParam, lParam)))
            {
                return(new IntPtr(1)); //MSDN: return true to allow request. We never deny, we just react on this.
                //WinUser.h: #define BROADCAST_QUERY_DENY         0x424D5144  // Return this value to deny a query.
            }
            return(IntPtr.Zero);
        }