Esempio n. 1
0
// Get a dispinterface for the IAccessibility object for the specified box.
void VwAccessRoot::GetAccessFor(VwBox * pbox, IDispatch ** ppdisp)
{
	*ppdisp = NULL;
	if (!pbox)
		return;
	IAccessiblePtr qacc;
	// If we already made one for that box, answer it. Otherwise make one.
	if (!ViewsGlobals::m_hmboxacc->Retrieve(pbox, qacc))
		qacc.Attach(NewObj VwAccessRoot(pbox));

	qacc->QueryInterface(IID_IDispatch, (void **)ppdisp);
}
Esempio n. 2
0
static IAccessible2* IAccessible2FromIdentifier(int docHandle, int id) {
	IAccessiblePtr acc = NULL;
	VARIANT varChild;
	// WebKit returns a positive value for uniqueID,
	// but we need to pass a negative value when retrieving objects.
	id = -id;
	if (AccessibleObjectFromEvent((HWND)UlongToHandle(docHandle), OBJID_CLIENT, id, &acc, &varChild) != S_OK)
		return NULL;
	if (varChild.lVal != CHILDID_SELF) {
		// IAccessible2 can't be implemented on a simple child,
		// so this object is invalid.
		return NULL;
	}
	VariantClear(&varChild);
	IServiceProviderPtr serv = NULL;
	if (acc.QueryInterface(IID_IServiceProvider, &serv) != S_OK)
		return NULL;
	IAccessible2* pacc2 = NULL;
	serv->QueryService(IID_IAccessible, IID_IAccessible2, (void**)&pacc2);
	return pacc2;
}