ChangeWindowMessageFilterEx() private méthode

private ChangeWindowMessageFilterEx ( IntPtr hWnd, int message, MessageFilterFlag dwFlag, IntPtr pChangeFilterStruct ) : bool
hWnd System.IntPtr
message int
dwFlag MessageFilterFlag
pChangeFilterStruct System.IntPtr
Résultat bool
Exemple #1
0
        public RPCResponseChannel(Process process)
            : base()
        {
            _Process = process;

            WM_RPC_MESSAGE = Win32.RegisterWindowMessage("ShootBlues.RPCMessage");

            var cp = new CreateParams {
                Caption = "ShootBlues.RPCChannel",
                X       = 0,
                Y       = 0,
                Width   = 0,
                Height  = 0,
                Style   = 0,
                ExStyle = WS_EX_NOACTIVATE,
                Parent  = new IntPtr(-3)
            };

            CreateHandle(cp);

            try {
                if (!Win32.ChangeWindowMessageFilterEx(
                        this.Handle, WM_RPC_MESSAGE, MessageFilterFlag.AllowMessage, IntPtr.Zero
                        ))
                {
                    var error = Win32.GetLastError();
                    throw new Exception(String.Format("Error changing window message filter: {0:x8}", error));
                }
            } catch (EntryPointNotFoundException) {
                try {
                    if (!Win32.ChangeWindowMessageFilter(
                            WM_RPC_MESSAGE, MessageFilterFlag.AllowMessage
                            ))
                    {
                        var error = Win32.GetLastError();
                        throw new Exception(String.Format("Error changing window message filter: {0:x8}", error));
                    }
                } catch (EntryPointNotFoundException) {
                }
            }
        }