[Mwinapi-commits] SF.net SVN: mwinapi:[131] trunk/ManagedWinapi/Accessibility/ AccessibleObjectList
Status: Beta
Brought to you by:
schierlm
From: <sch...@us...> - 2015-12-08 22:10:08
|
Revision: 131 http://sourceforge.net/p/mwinapi/code/131 Author: schierlm Date: 2015-12-08 22:10:07 +0000 (Tue, 08 Dec 2015) Log Message: ----------- added property 'HookFlags' to 'AccessibleEventListener' % pushed from GitHub % Author: fk <enoon1 at arcor.de> % Date: Fri Dec 4 12:08:31 2015 +0100 Modified Paths: -------------- trunk/ManagedWinapi/Accessibility/AccessibleObjectListener.cs Modified: trunk/ManagedWinapi/Accessibility/AccessibleObjectListener.cs =================================================================== --- trunk/ManagedWinapi/Accessibility/AccessibleObjectListener.cs 2015-07-07 15:14:52 UTC (rev 130) +++ trunk/ManagedWinapi/Accessibility/AccessibleObjectListener.cs 2015-12-08 22:10:07 UTC (rev 131) @@ -27,6 +27,7 @@ /// <summary> /// Listens to events from the Windows accessibility system. These events are useful /// if you want to write a screenreader or similar program. + /// For more information search the MSDN-documentation for the keyword 'WinEvents'. /// </summary> public class AccessibleEventListener : Component { @@ -43,6 +44,7 @@ private GCHandle gch; private UInt32 processId = 0; private UInt32 threadId = 0; + private AccessibleEventFlags hookFlags = AccessibleEventFlags.OUTOFCONTEXT; /// <summary> /// Initializes a new instance of this class with the specified container. @@ -119,6 +121,30 @@ set { threadId = value; updateListener(); } } + /// <summary> + /// The location of the hook function and of the events to be skipped. + /// </summary> + public AccessibleEventFlags HookFlags + { + get { return hookFlags; } + set + { + if (!( + value == AccessibleEventFlags.INCONTEXT || + value == AccessibleEventFlags.OUTOFCONTEXT || + value == (AccessibleEventFlags.OUTOFCONTEXT | AccessibleEventFlags.SKIPOWNPROCESS) || + value == (AccessibleEventFlags.OUTOFCONTEXT | AccessibleEventFlags.SKIPOWNTHREAD) || + value == (AccessibleEventFlags.INCONTEXT | AccessibleEventFlags.SKIPOWNPROCESS) || + value == (AccessibleEventFlags.INCONTEXT | AccessibleEventFlags.SKIPOWNTHREAD) + )) + { + throw new ArgumentException("Invalid flags."); + } + hookFlags = value; + updateListener(); + } + } + private void updateListener() { if (handle != IntPtr.Zero) @@ -128,7 +154,7 @@ } if (enabled) { - handle = SetWinEventHook(min, max, IntPtr.Zero, internalDelegate, processId, threadId, 0); + handle = SetWinEventHook(min, max, IntPtr.Zero, internalDelegate, processId, threadId, (uint)hookFlags); } } @@ -292,7 +318,33 @@ } } + /// <summary> + /// This enumeration lists Flag values that specify the location of the hook function and of the events to be skipped. + /// </summary> + [Flags] + public enum AccessibleEventFlags + { + + /// <summary> + /// The callback function is not mapped into the address space of the process that generates the event. + /// </summary> + OUTOFCONTEXT = 0x0000, + /// <summary> + /// Prevents this instance of the hook from receiving the events that are generated by the thread that is registering this hook. + /// </summary> + SKIPOWNTHREAD = 0x0001, + /// <summary> + /// Prevents this instance of the hook from receiving the events that are generated by threads in this process. This flag does not prevent threads from generating events. + /// </summary> + SKIPOWNPROCESS = 0x0002, + /// <summary> + /// The DLL that contains the callback function is mapped into the address space of the process that generates the event. + /// </summary> + INCONTEXT = 0x0004 + } + + /// <summary> /// This enumeration lists known accessible event types. /// </summary> public enum AccessibleEventType This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |