crushglass

I'm try to use the function "AccessibleObjectFromPoint()" to get some message from
controls.Sometimes the function return S_OK, but sometimes the function return -2147417843
(RPC_E_CANTCALLOUT_ININPUTSYNCCALL). when the parameter point within the bound of a control which don't have a handle of form.It isn't correct.

So I need some help



Re: Microsoft UI Automation How can I use AccessibleObjectFromPoint() with C#(MSAA)

Marco Achtziger

Could you please post the pinvoke to AccessibleObjectFromPoint





Re: Microsoft UI Automation How can I use AccessibleObjectFromPoint() with C#(MSAA)

crushglass

// Define
public const int S_OK = 0x00000000;
[DllImport("oleacc.dll")]
public static extern int AccessibleObjectFromPoint(int x, int y, ref IAccessible ppacc, ref object pvarChild);

// Call
// x,y are in the bounds of control
int result = AccessibleObjectFromPoint(x, y, ref IAccessible, ref pvarChild);

//// By the way, I don' t think the problem is a PInvoke problem. I think the problem occur when I wanna get some information about controls in other process with COM £¨http:// support.microsoft.com/kb/131056/EN-US/£©. But the function don' t return -2147417843, sometimes it return S_OK. I don't know how to solve.




Re: Microsoft UI Automation How can I use AccessibleObjectFromPoint() with C#(MSAA)

Marco Achtziger

Hm.

I use this pinvoke
Code Snippet

[DllImport("oleacc.dll")]
public static extern int AccessibleObjectFromPoint(System.Drawing.Point ptScreen, out IAccessible ppvObject, out object variant);



And you also use OLE Because the link you posted is about using this.

I do not encounter the error you see on any application. And i am always staying out of the process.

Maybe some more information about your application and what you would do could help.





Re: Microsoft UI Automation How can I use AccessibleObjectFromPoint() with C#(MSAA)

crushglass

I change function define as you tell me. The problem occurs also.

[DllImport("oleacc.dll")]
public static extern int AccessibleObjectFromPoint(System.Drawing.Point ptScreen, out IAccessible ppvObject, out object variant);

In fact, I wanna capture screen and capture control like button, menu, cell and so on when I use other application. I can't get the position and size of controls like a button in word toolsbar from hWnd. So I want to use MSAA, but the problem was occur.





Re: Microsoft UI Automation How can I use AccessibleObjectFromPoint() with C#(MSAA)

Marco Achtziger

Hm. I am not sure if i really got it.

But does Accexplorer work the right way on your machine Do you want to test the software or just want to automate it





Re: Microsoft UI Automation How can I use AccessibleObjectFromPoint() with C#(MSAA)

crushglass

Yeah, Accexplorer work well on my machine I don't want to test the software or to automate it, I just want to capture screen or control into bitmaps to save my operation in other application.

By the way, you are very friendly, thank you for your reply. I want to be your friend.

Thank you.





Re: Microsoft UI Automation How can I use AccessibleObjectFromPoint() with C#(MSAA)

Marco Achtziger

Sounds like that you want to generate a documentation. Maybe you should use a specialized software. I know there are free ones. I just read about one. But right now i cannot remember the name. ;-) A short google or asking Ms.Dewey could help.