_ChangeWindowMessageFilter() 개인적인 메소드

private _ChangeWindowMessageFilter ( WM message, MSGFLT dwFlag ) : bool
message WM
dwFlag MSGFLT
리턴 bool
예제 #1
0
        public static HRESULT ChangeWindowMessageFilterEx(IntPtr hwnd, WM message, MSGFLT action, out MSGFLTINFO filterInfo)
        {
            filterInfo = MSGFLTINFO.NONE;

            if (!Utility.IsOSVistaOrNewer)
            {
                return(HRESULT.S_FALSE);
            }
            if (!Utility.IsOSWindows7OrNewer)
            {
                if (!NativeMethods._ChangeWindowMessageFilter(message, action))
                {
                    return((HRESULT)Win32Error.GetLastError());
                }
                return(HRESULT.S_OK);
            }
            else
            {
                CHANGEFILTERSTRUCT changefilterstruct = new CHANGEFILTERSTRUCT
                {
                    cbSize = (uint)Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT))
                };
                if (!NativeMethods._ChangeWindowMessageFilterEx(hwnd, message, action, ref changefilterstruct))
                {
                    return((HRESULT)Win32Error.GetLastError());
                }
                filterInfo = changefilterstruct.ExtStatus;
                return(HRESULT.S_OK);
            }
        }