AccessibleObjectFromWindow and Window Forms .NET 2 application

G

Guest

Why does the SDK call AccessibleObjectFromWindow, when passed an HWND of a
Window Forms .NET 2 application (class:
WindowsForms10.Window.8.app.0.33c0d9d), not return an IAccessible?

When the class of the HWND is ‘#32770’ (used by Sage Line 50 v11) or
‘OFormSub’ (used by Microsoft Access 2003) an IAccessible is returned, the
type of the IAccessible variable is ‘System.__ComObject’, and all the
IAccessible properties and methods, accParent, accChildCount and get_accName
Etc are available.

When the class of the HWND is ‘WindowsForms10.Window.8.app.0.33c0d9d’ (used
by my Windows Forms .NET 2 test application) the type of variable reported in
the Debugger Watch window is
‘System.Runtime.Remoting.Proxies.__TransparentProxy’, but calling the
GetType() method on the variable returns
‘System.Windows.Forms.InternalAccessibleObject’.
Trying to access any of the IAccessible properties/methods, eg. get_accName,
results in a ‘System.Runtime.Remoting.RemotingException’ being thrown. How do
I get at the IAccessible properties/methods from the object returned by the
AccessibleObjectFromWindow call?

C# Code snippet:
[DllImport("Oleacc.dll")]
public static extern int AccessibleObjectFromWindow(
IntPtr hwnd,
int dwObjectID,
ref Guid refID,
ref Accessibility.IAccessible ppvObject);

public const string sIAccessibleGUID = "618736E0-3C3D-11CF-810C-00AA00389B71";

Accessibility.IAccessible IAParent = null;
Guid guidCOM = new Guid(sIAccessibleGUID);

public enum NativeMsg : int
{
// See ...\PlatformSDK\Include\WinUser.h for these values
CHILDID_SELF = 0,
CHILDID_1 = 1,
OBJID_CLIENT = -4, // 0xFFFFFFFC
}

NativeWin32.AccessibleObjectFromWindow(m_hWndParent,
(int)NativeMsg.OBJID_CLIENT, ref guidCOM, ref IAParent);

I am using Visual Studio 2005 Professional on Windows 2000 SP4.

Any help most appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top