|
|
|
date: Tue, 4 Apr 2006 14:00:03 -0700,
group: microsoft.public.inetsdk.programming.html_objmodel
back
Re: HOWTO Get an IHTMLElement object from IAccessible
I think I can get you part way there.
On the Accessibility side you can call get_accFocus() to find out which
element has keyboard focus.
On the DOM side you can find out which element has focus by calling
IHTMLDocument2.activeElement()
You can get to a document object to make this call from your Accessible
object starting point by getting the HTMLElement from the Accessible Object,
then getting the document from the HTMLElement.
As to getting or setting just the selected text, or controlling the text
selection - I can't help you with that.
Bill
"ATS" wrote in message
news:12D96A45-7A3C-4E77-8C18-0DD7877015D6@microsoft.com...
> Thanks for the reply, I found almost all I needed and had managed to make
> a
> Spy program from IAccessible. The trick was knowing that IAccessible leads
> to
> an IHTMLWindow or IHTMLElement object (one or the other).
>
> But! I did not find a way to capture the currently selected text. With
> windows, I would use EM_GETSELTEXT or some derivation there of to get the
> currently selected text for NON-Rech Edit controls, and WM_COPY for Rich
> Edit
> controls.
>
> But with IAccessible, I could not find a simple solution. First I tried
> IAccessible's get_accSelect, but it does not capture the selected text.
> So I
> tried to use IAccessible to get the DOM from an IHTMLElement/IHTMLWindow,
> and
> to my surprise, the DOM (MSHTML) does not seem to have a "GetFocus"
> function
> to let one get the element with the focus, or anything to issue an
> equivalent
> of EM_GETSELTEXT or WM_COPY.
>
> Any ideas? I'd really like to just somehow issue a WM_COPY equivalent on a
> given IAccessible object or the DOM.
>
>
>
date: Thu, 20 Apr 2006 12:31:16 -0500
author: Aberro-Bill am
|
|