Program execution hangs at accSelect.
-
I use the following lines of code in my program to get focus to a particular object and select it: hr = (SELFLAG_TAKEFOCUS,varTemp); hr = pTempAcc->accLocation(&left,&top,&width,&height,varTemp); The trouble is that after the my program has been running for a while ( as such there is no specific limit or minimum), the execution just hangs at pTempAcc->accSelect() and the only way to stop it is a forced exit. Can anyone tell me why this might happen.
-
I use the following lines of code in my program to get focus to a particular object and select it: hr = (SELFLAG_TAKEFOCUS,varTemp); hr = pTempAcc->accLocation(&left,&top,&width,&height,varTemp); The trouble is that after the my program has been running for a while ( as such there is no specific limit or minimum), the execution just hangs at pTempAcc->accSelect() and the only way to stop it is a forced exit. Can anyone tell me why this might happen.
There appears to be some code missing from the 1st line you posted. Looking at the MSDN page for IAccessible::accSelect Method[^] we can see an example given as:
HRESULT SelectItemAtPoint(POINT point)
{
VARIANT varItem;
IAccessible* pAcc;
HRESULT hr = AccessibleObjectFromPoint(point, &pAcc, &varItem);
if ((hr == S_OK))
{
hr = pAcc->accSelect((SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION), varItem);
VariantClear(&varItem);
pAcc->Release();
}
return hr;
}Which immediately causes me to wonder if perhaps you haven't done the clean-up for your equivalents of varItem and pAcc in the above block
-
There appears to be some code missing from the 1st line you posted. Looking at the MSDN page for IAccessible::accSelect Method[^] we can see an example given as:
HRESULT SelectItemAtPoint(POINT point)
{
VARIANT varItem;
IAccessible* pAcc;
HRESULT hr = AccessibleObjectFromPoint(point, &pAcc, &varItem);
if ((hr == S_OK))
{
hr = pAcc->accSelect((SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION), varItem);
VariantClear(&varItem);
pAcc->Release();
}
return hr;
}Which immediately causes me to wonder if perhaps you haven't done the clean-up for your equivalents of varItem and pAcc in the above block
The same problem occurs even when i give both the flags as follows:
hr = pAcc->accSelect((SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION), varItem);
-
The same problem occurs even when i give both the flags as follows:
hr = pAcc->accSelect((SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION), varItem);
-
Clean up does not help either.