Revision: 111
http://mwinapi.svn.sourceforge.net/mwinapi/?rev=111&view=rev
Author: schierlm
Date: 2012-01-03 21:56:22 +0000 (Tue, 03 Jan 2012)
Log Message:
-----------
Add support for requesting COM Automation object from a window, useful
for controlling Microsoft Office applications.
[submitted by S?\195?\169bastien de Menten <sdementen at gmail dot com>]
Modified Paths:
--------------
trunk/ManagedWinapi/SystemAccessibleObject.cs
Modified: trunk/ManagedWinapi/SystemAccessibleObject.cs
===================================================================
--- trunk/ManagedWinapi/SystemAccessibleObject.cs 2011-10-15 17:25:38 UTC (rev 110)
+++ trunk/ManagedWinapi/SystemAccessibleObject.cs 2012-01-03 21:56:22 UTC (rev 111)
@@ -100,6 +100,17 @@
}
/// <summary>
+ /// Gets the automation object for a given window.
+ /// This is a COM object implementing the IDispatch interface, commonly
+ /// available from Microsoft Office windows.
+ /// </summary>
+ /// <param name="window">The window</param>
+ public static object COMObjectFromWindow(SystemWindow window)
+ {
+ return AccessibleObjectFromWindow(window == null ? IntPtr.Zero : window.HWnd, OBJID_NATIVEOM, new Guid("{00020400-0000-0000-C000-000000000046}"));
+ }
+
+ /// <summary>
/// Gets an accessibility object for the mouse cursor.
/// </summary>
public static SystemAccessibleObject MouseCursor
@@ -600,6 +611,8 @@
#region PInvoke Declarations
+ const uint OBJID_NATIVEOM = 0xFFFFFFF0;
+
[DllImport("oleacc.dll")]
private static extern IntPtr AccessibleObjectFromPoint(POINT pt, [Out, MarshalAs(UnmanagedType.Interface)] out IAccessible accObj, [Out] out object ChildID);
[DllImport("oleacc.dll")]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|