Re: Obtaining text from AfxWndW Windows

  • From: "Will Pearson" <will@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 10 Dec 2007 00:48:47 -0000

Hi Sean,

WM_GETTEXT doesn't work with the AfxWnd windows used by MFC.  I think they use 
some sort of different mechanism to handle their window text and drawing.

You could try looking at the control's MSAA properties using a tool such as 
Inspect or AccExplorer, both of which are part of the MSAA SDK tools.  If these 
shw information then you could get the IAccessible object using something like 
AccessibleObjectFromWindow.  As it's a custom control then whether MSAA is 
present depends on whether the C++ libraries team implemented MSAA for the 
custom controls contained within MFC; The MSAA system won't proxy AfxWnd 
controls to my knowledge.

The reason why I suspect JAWS picks it up is that it is being detected by the 
off screen model in JAWS.  Whilst JAWS, and several other screen readers, 
intercept the GDI drawing calls at the video driver level you can replicate 
this functionality by hooking into the GDI API.  If you want to go down this 
route then there are documents and things on the web that explain API hooking 
better than I can.

Will
  ----- Original Message ----- 
  From: Sean Farrow 
  To: programmingblind@xxxxxxxxxxxxx 
  Sent: Sunday, December 09, 2007 11:32 PM
  Subject: Obtaining text from AfxWndW Windows


  Hi: 
  I am trying to obtain text from an AfxWndW window. Previously I have been 
able to obtain text from another control using the SendMessageW function with 
the WM_GETTEXT message. These two particular windows are in the same program 
and are also on the same screen. 
  The program is the microsoft woutlook 2003 calendar. 
  in the window I want, neither the wm_gettext message orthe GetWindowTextW 
functions work. Jaws however gives me the text. Anyone got and ideas how to 
tacle this.
  I tryed msaa with the OBJID_WINDOW but there was no name for the window.
  Any help apreciated
  Sean.

Other related posts: