/// <summary> /// Enables a specified message to be sent to the window from non-Administrator processes /// </summary> /// <param name="source"></param> /// <param name="msg"></param> /// <returns></returns> static bool EnableWindowMessage(HwndSource source, uint msg) { CHANGEFILTERSTRUCT filterStatus = new CHANGEFILTERSTRUCT(); filterStatus.size = (uint)Marshal.SizeOf(filterStatus); filterStatus.info = 0; return(ChangeWindowMessageFilterEx(source.Handle, msg, ChangeWindowMessageFilterExAction.Allow, ref filterStatus)); }
public static extern bool ChangeWindowMessageFilterEx(IntPtr hWnd, uint msg, ChangeWindowMessageFilterExAction action, ref CHANGEFILTERSTRUCT changeInfo);