Beispiel #1
0
        private void GetMsg_GetMsg(IntPtr Handle, IntPtr Message, IntPtr wParam, IntPtr lParam)
        {
            // When the user selects an item from the system menu on a window, Windows sends a WM_SYSCOMMAND
            // message to the application, with the MenuID in the low-order word of wParam. If that sentence
            // meant nothing to you, it means you have yet to really experience the joys of programming the
            // Windows API. Anyways, this function is called whenever a message is posted somewhere, so we
            // filter out only the WM_SYSCOMMAND messages, then check to see if they apply to a window that
            // we're monitoring, and then see if it was one of our menu items that was selected.
            if (Message.ToInt32() == Win32.WM_SYSCOMMAND)
            {
                int LowOrder  = (wParam.ToInt32() & 0x0000FFFF);
                int HighOrder = wParam.ToInt32() - LowOrder;

                Window W = FindWindow(Handle);
                if (W != null)
                {
                    if (LowOrder == Form1.SC_FADEOUT)
                    {
                        W.FadeOut();
                    }
                    else if (LowOrder == Form1.SC_FADEIN)
                    {
                        W.FadeIn();
                    }
                    else if (LowOrder == Form1.SC_TRANS100)
                    {
                        W.SetTransparency(255);
                    }
                    else if (LowOrder == Form1.SC_TRANS95)
                    {
                        W.SetTransparency(242);
                    }
                    else if (LowOrder == Form1.SC_TRANS90)
                    {
                        W.SetTransparency(230);
                    }
                    else if (LowOrder == Form1.SC_TRANS85)
                    {
                        W.SetTransparency(217);
                    }
                    else if (LowOrder == Form1.SC_TRANS80)
                    {
                        W.SetTransparency(204);
                    }
                    else if (LowOrder == Form1.SC_TRANS75)
                    {
                        W.SetTransparency(191);
                    }
                    else if (LowOrder == Form1.SC_TRANS70)
                    {
                        W.SetTransparency(179);
                    }
                    else if (LowOrder == Form1.SC_TRANSCLEAR)
                    {
                        W.ClearTransparency();
                    }
                }
            }
        }