コード例 #1
0
        private void MaxMinWindow(int index)
        {
            //const int SW_MAXIMIZE = 3;
            //const int SW_MINIMIZE = 6;
            const int SW_RESTORE       = 9;
            const int SW_SHOWMINIMIZED = 2;
            const int SW_SHOWMAXIMIZED = 3;

            IntPtr hwnd = pluginServer.ExplorerHandle;

            if (hwnd != IntPtr.Zero)
            {
                int nCmdShow;
                switch (index)
                {
                case 13:
                    // Minimize
                    nCmdShow = SW_SHOWMINIMIZED;
                    break;

                case 14:
                    // Restore
                    nCmdShow = SW_RESTORE;
                    break;

                default:        //12
                    // Maximize
                    nCmdShow = SW_SHOWMAXIMIZED;
                    break;
                }

                PInvoke_QTWM.ShowWindow(hwnd, nCmdShow);
            }
        }
コード例 #2
0
        private void RestoreInitialSize()
        {
            bool fLoc    = (ConfigValues[0] & 0x20) != 0;
            bool fSiz    = (ConfigValues[0] & 0x80) != 0;
            bool fPreset = (ConfigValues[0] & 0x10) != 0;

            if (fLoc || fSiz || fPreset)
            {
                IntPtr hwnd = pluginServer.ExplorerHandle;
                if (hwnd != IntPtr.Zero)
                {
                    if (PInvoke_QTWM.IsZoomed(hwnd))
                    {
                        const int SW_RESTORE = 9;
                        PInvoke_QTWM.ShowWindow(hwnd, SW_RESTORE);
                    }

                    if (fPreset)
                    {
                        if (!String.IsNullOrEmpty(startingPreset) && dicPresets.ContainsKey(startingPreset))
                        {
                            Rectangle rctPreset = dicPresets[startingPreset];
                            PInvoke_QTWM.SetWindowPos(hwnd, IntPtr.Zero, rctPreset.X, rctPreset.Y, rctPreset.Width, rctPreset.Height, SWP_NOZORDER);
                            RemoveMAXIMIZE(hwnd);
                        }
                        return;
                    }

                    uint uFlags = SWP_NOZORDER | (fLoc ? 0 : SWP_NOMOVE) | (fSiz ? 0 : SWP_NOSIZE);

                    PInvoke_QTWM.SetWindowPos(
                        hwnd,
                        IntPtr.Zero,
                        pntInitial.X,
                        pntInitial.Y,
                        sizeInitial.Width,
                        sizeInitial.Height,
                        uFlags);

                    RemoveMAXIMIZE(hwnd);
                }
            }
        }