Writing with AccessibleObjectFromPoint()

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5353
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Writing with AccessibleObjectFromPoint()

Post by Kwai chang caine »

Hello at all

From the nice code of RASHAD
http://forums.purebasic.com/english/vie ... 59#p524088

Is it possible to write with the same style of function (Obviously if the field is writable) ?

Code: Select all

Procedure TextFromWindowPosition(*Name.string, *Value.string)
  GetCursorPos_(@p)
  If AccessibleObjectFromPoint(p\y<<32|p\x,@*pIAcc,@vt)=#S_OK
    *Name\s=""
    If *pIAcc\get_accName(vt, @pName) = #S_OK
      len = SysStringLen_(pName)
      *Name\s = Space(len)
      WideCharToMultiByte_(#CP_ACP, 0,pName, -1, @*Name\s, len, 0, 0)
      *Name\s = PeekS(@*Name\s, len, #PB_UTF8)
      SysFreeString_(pName)
    EndIf
    *Value\s=""
    *pIAcc\Release()
  EndIf
  ProcedureReturn #True
EndProcedure
For example replacing

Code: Select all

*Name\s = PeekS(@*Name\s, len, #PB_UTF8)
by a style of

Code: Select all

PokeS(@*Name\s, "Kcc", 4, #PB_UTF8) 
or perhaps use

Code: Select all

*pIAcc\put_accName
*pIAcc\put_accValue
Have a good day
ImageThe happiness is a road...
Not a destination