I've been trying to marshal AccessibileObjectFromWindow without luck. The code compiles but I get an exception at the line Marshal.Queryinterface which reads "System.NullReferenceException, Object reference not set to an instance of an object". What did I do wrong?
Thanks.
[DllImport("Oleacc.dll")]
private static extern long AccessibleObjectFromWindow(int windowHandle, int objectID, Guid refID, ref IntPtr accessibleObject);
//winable.h constants
private int OBJID_WINDOW = 0x0;
public void GetWindow(int handleWindow)
{
IAccessible iDialogWindow = null;
//Guid obtained from OleAcc.idl from Platform SDK
Guid iAccessibleGuid = new Guid("618736e0-3c3d-11cf-810c-00aa00389b71");
IntPtr dialogWindow = Marshal.AllocCoTaskMem(4);
IntPtr dialogWindowp = Marshal.AllocCoTaskMem(4);
Marshal.StructureToPtr(dialogWindow, dialogWindowp, false);
Bookmarks