Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

ChangeWindowMessageFilterEx (user32)
 
.
Summary
Modifies the User Interface Privilege Isolation (UIPI) message filter for a specified window.

C# Signature:

[DllImport("user32.dll", SetLastError=true)]
public static extern bool ChangeWindowMessageFilterEx(IntPtr hWnd, uint msg, ChangeWindowMessageFilterExAction action,ref CHANGEFILTERSTRUCT changeInfo);

VB Signature:

<DllImport("user32.dll")> _
Private Shared Function ChangeWindowMessageFilterEx(hWnd As IntPtr, msg As UInteger, action As ChangeWindowMessageFilterExAction, ByRef changeInfo As CHANGEFILTERSTRUCT) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function

User-Defined Field Types C#:

Declare Function ChangeWindowMessageFilterEx Lib "user32.dll" (TODO) As TODO

User-Defined Field Types:

    public enum MessageFilterInfo : uint
    {
        None=0, AlreadyAllowed=1, AlreadyDisAllowed=2, AllowedHigher=3
    };

    public enum ChangeWindowMessageFilterExAction : uint
    {
        Reset = 0, Allow = 1, DisAllow = 2
    };

    [StructLayout(LayoutKind.Sequential)]
    public struct CHANGEFILTERSTRUCT
    {
        public uint size;
        public MessageFilterInfo info;
    }

User-Defined Field Types VB:

    Private Enum MessageFilterInfo As UInteger
        None
        AlreadyAllowed
        AlreadyDisAllowed
        AllowedHigher
    End Enum

    Private Enum ChangeWindowMessageFilterExAction As UInteger
        Reset
        Allow
        Disallow
    End Enum

    Private Enum ChangeWindowMessageFilterFlags As UInteger
        Add = 1
        Remove = 2
    End Enum

    <StructLayout(LayoutKind.Sequential)> _
    Private Structure CHANGEFILTERSTRUCT
        Public cbSize As UInteger
        Public ExtStatus As MessageFilterInfo
    End Structure

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

See documentation for full use and return values

None.

Tips & Tricks:

Can use this too:

ChangeWindowMessageFilterEx(Handle,_message,ChangeWindowMessageFilterExAction.Allow, IntPtr.Zero);

If you do not care about the filterStatus

Sample Code:

    CHANGEFILTERSTRUCT filterStatus = new CHANGEFILTERSTRUCT();
        filterStatus.size= (uint) Marshal.SizeOf(filterStatus);
        filterStatus.info = 0;
        ChangeWindowMessageFilterEx(Handle,_message,ChangeWindowMessageFilterExAction.Allow, ref filterStatus);

Note
Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions