Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. IAccessible - get word under mouse pointer in IE

IAccessible - get word under mouse pointer in IE

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fourblack
    wrote on last edited by
    #1

    I use IAccessible and presently I can get text string from Internet Explorer. I put my code below. But how I can get one word from this text string directly under mouse pointer? Not whole string, ,only one word under mouse pointer? Thanks in advance.

    CString Name;

    CPoint CursorPos;
    GetCursorPos( &CursorPos );

    IAccessiblePtr pIAcc;
    _variant_t vt;

    BSTR pName = NULL;
    BSTR pValue = NULL;

    if( SUCCEEDED( AccessibleObjectFromPoint( CursorPos, &pIAcc, &vt )))
    {
    pIAcc->get_accChild(
    BSTR pName = NULL;
    if( SUCCEEDED( pIAcc->get_accName( vt, &pName )))
    {
    if( pName && ::SysStringLen( pName ))
    {
    Name = pName;
    }
    ::SysFreeString( pName );
    }
    }

    S 1 Reply Last reply
    0
    • F Fourblack

      I use IAccessible and presently I can get text string from Internet Explorer. I put my code below. But how I can get one word from this text string directly under mouse pointer? Not whole string, ,only one word under mouse pointer? Thanks in advance.

      CString Name;

      CPoint CursorPos;
      GetCursorPos( &CursorPos );

      IAccessiblePtr pIAcc;
      _variant_t vt;

      BSTR pName = NULL;
      BSTR pValue = NULL;

      if( SUCCEEDED( AccessibleObjectFromPoint( CursorPos, &pIAcc, &vt )))
      {
      pIAcc->get_accChild(
      BSTR pName = NULL;
      if( SUCCEEDED( pIAcc->get_accName( vt, &pName )))
      {
      if( pName && ::SysStringLen( pName ))
      {
      Name = pName;
      }
      ::SysFreeString( pName );
      }
      }

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      Reading the word under the cursor via UI Automation[^] This example is in C# but you should be able to make a C++ version easily enough.

      Steve

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups