Link to home
Create AccountLog in
Avatar of cookey
cookey

asked on

Some problem with AccessibleChildren function declare

I want to find a DirectUIhwnd's child control,so I implement the following code:

function AccessibleObjectFromWindow(Ahwnd: HWND;  dwObjectID: DWORD;  const riid: TGUID;  out ppvObject  ): HResult; stdcall; external 'OLEACC.DLL' name 'AccessibleObjectFromWindow';

function AccessibleChildren(  paccContainer: IAccessible;  iChildStart: LONGINT;  cChildren: LONGINT;  out rgvarChildren: PVarArray;  out pcObtained: LONGINT  ): HRESULT;stdcall; external 'OLEACC.DLL' name 'AccessibleChildren';
//////////////////////////////////////////////////////////////////
var
   x,i:integer;
  pa:PVarArray;
  blub: IAccessible;
  l:longint;

begin
    ....
    ....
   if AccessibleObjectFromWindow(FirstDlgHd, 0, IID_IAccessible, blub) = S_OK then
    begin
      x := blub.Get_accChildCount;
      AccessibleChildren(blub, 0, x, pa, L); // this token has problem, the "pa" paramitere result is $9,and the length of "pa" is zero,
     pa[0].Get_accName(0);//this token will raise an error, pa[0] is nil;
  end;

Wether the declare of "AccessibleChildren" is wrong or I use  "PVarArray" wrongly or improperly ?
Avatar of cookey
cookey

ASKER

Nobody knows?
how are you initialize pa variable?
And that is GetLastError after run AccessibleChildren function?
ASKER CERTIFIED SOLUTION
Avatar of sas13
sas13
Flag of Russian Federation image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Forced accept.

Computer101
EE Admin