+// Gets the standard IAccessible interface for the given child or object.
+// Call Release if this is non-NULL.
+IAccessible* wxIAccessible::GetChildStdAccessible(int id)
+{
+ if (id == 0)
+ {
+ IAccessible* obj = (IAccessible*)m_pAccessible->GetIAccessibleStd();
+
+ obj->AddRef();
+ return obj;
+ }
+ else
+ {
+ VARIANT var;
+ VariantInit(& var);
+ var.vt = VT_I4;
+ var.lVal = id;
+ IDispatch* pDispatch = NULL;
+ if (S_OK == get_accChild ( var, & pDispatch))
+ {
+ IAccessible* childAccessible = NULL;
+ if (pDispatch->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK)
+ {
+ pDispatch->Release();
+ wxIAccessible* c = (wxIAccessible*) childAccessible;
+ IAccessible* stdChildAccessible = (IAccessible*) c->m_pAccessible->GetIAccessibleStd();
+ stdChildAccessible->AddRef();
+ childAccessible->Release();
+ return stdChildAccessible;
+ }
+ else
+ {
+ pDispatch->Release();
+ }
+ }
+ }
+
+#if 0
+ {
+ // Loop until we find the right id
+ long nChildren = 0;
+ this->get_accChildCount(& nChildren);
+
+ int i;
+ for (i = 0; i < nChildren; i++)
+ {
+ long obtained = 0;
+ VARIANT var;
+ VariantInit(& var);
+ var.vt = VT_I4;
+ if (S_OK == AccessibleChildren(this, i, 1, & var, &obtained))
+ {
+ if (var.lVal == id)
+ {
+ VariantInit(& var);
+ var.vt = VT_DISPATCH;
+ if (S_OK == AccessibleChildren(this, i, 1, & var, &obtained))
+ {
+ IAccessible* childAccessible = NULL;
+ if (var.pdispVal->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK)
+ {
+ var.pdispVal->Release();
+ return childAccessible;
+ }
+ else
+ {
+ var.pdispVal->Release();
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+#endif
+ return NULL;
+}
+
+// Gets the IAccessible interface for the given child or object.
+// Call Release if this is non-NULL.
+IAccessible* wxIAccessible::GetChildAccessible(int id)
+{
+ if (id == 0)
+ {
+ IAccessible* obj = this;
+
+ obj->AddRef();
+ return obj;
+ }
+ else
+ {
+ VARIANT var;
+ VariantInit(& var);
+ var.vt = VT_I4;
+ var.lVal = id;
+ IDispatch* pDispatch = NULL;
+ if (S_OK == get_accChild ( var, & pDispatch))
+ {
+ IAccessible* childAccessible = NULL;
+ if (pDispatch->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK)
+ {
+ pDispatch->Release();
+ return childAccessible;
+ }
+ else
+ {
+ pDispatch->Release();
+ }
+ }
+ }
+ return NULL;
+}
+