public static void PostMessage(IntPtr hWnd, Standard.WM Msg, IntPtr wParam, IntPtr lParam)
 {
     if (!_PostMessage(hWnd, Msg, wParam, lParam))
     {
         throw new Win32Exception();
     }
 }
        private static IntPtr _WndProc(IntPtr hwnd, Standard.WM msg, IntPtr wParam, IntPtr lParam)
        {
            IntPtr zero = IntPtr.Zero;

            Standard.MessageWindow target = null;
            if (msg == Standard.WM.CREATE)
            {
                Standard.CREATESTRUCT createstruct = (Standard.CREATESTRUCT)Marshal.PtrToStructure(lParam, typeof(Standard.CREATESTRUCT));
                target = (Standard.MessageWindow)GCHandle.FromIntPtr(createstruct.lpCreateParams).Target;
                s_windowLookup.Add(hwnd, target);
            }
            else if (!s_windowLookup.TryGetValue(hwnd, out target))
            {
                return(Standard.NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam));
            }
            Standard.WndProc proc = target._wndProcCallback;
            if (proc != null)
            {
                zero = proc(hwnd, msg, wParam, lParam);
            }
            else
            {
                zero = Standard.NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam);
            }
            if (msg == Standard.WM.NCDESTROY)
            {
                target._Dispose(true, true);
                GC.SuppressFinalize(target);
            }
            return(zero);
        }
 public static Standard.HRESULT ChangeWindowMessageFilterEx(IntPtr hwnd, Standard.WM message, Standard.MSGFLT action, out Standard.MSGFLTINFO filterInfo)
 {
     filterInfo = Standard.MSGFLTINFO.NONE;
     if (!Standard.Utility.IsOSVistaOrNewer)
     {
         return(Standard.HRESULT.S_FALSE);
     }
     if (!Standard.Utility.IsOSWindows7OrNewer)
     {
         if (!_ChangeWindowMessageFilter(message, action))
         {
             return((Standard.HRESULT)Standard.Win32Error.GetLastError());
         }
         return(Standard.HRESULT.S_OK);
     }
     Standard.CHANGEFILTERSTRUCT pChangeFilterStruct = new Standard.CHANGEFILTERSTRUCT {
         cbSize = (uint)Marshal.SizeOf(typeof(Standard.CHANGEFILTERSTRUCT))
     };
     if (!_ChangeWindowMessageFilterEx(hwnd, message, action, ref pChangeFilterStruct))
     {
         return((Standard.HRESULT)Standard.Win32Error.GetLastError());
     }
     filterInfo = pChangeFilterStruct.ExtStatus;
     return(Standard.HRESULT.S_OK);
 }
 private static extern bool _PostMessage(IntPtr hWnd, Standard.WM Msg, IntPtr wParam, IntPtr lParam);
 public static extern IntPtr SendMessage(IntPtr hWnd, Standard.WM Msg, IntPtr wParam, IntPtr lParam);
 public static extern bool DwmDefWindowProc(IntPtr hwnd, Standard.WM msg, IntPtr wParam, IntPtr lParam, out IntPtr plResult);
 public static extern IntPtr DefWindowProc(IntPtr hWnd, Standard.WM Msg, IntPtr wParam, IntPtr lParam);
 private static extern bool _ChangeWindowMessageFilterEx(IntPtr hwnd, Standard.WM message, Standard.MSGFLT action, [In, Out, Optional] ref Standard.CHANGEFILTERSTRUCT pChangeFilterStruct);
 private static extern bool _ChangeWindowMessageFilter(Standard.WM message, Standard.MSGFLT dwFlag);