LRESULT CBCGPWnd::OnGetObject(WPARAM wParam, LPARAM lParam) { if (globalData.IsAccessibilitySupport () && IsAccessibilityCompatible ()) { #if _MSC_VER >= 1300 return CWnd::OnGetObject (wParam, lParam); #else if ((DWORD)lParam == OBJID_CLIENT) { LPUNKNOWN pUnknown = GetInterface(&IID_IAccessible); if (!pUnknown) { return E_FAIL; } m_pStdObject = (IAccessible*)pUnknown; return LresultFromObject(IID_IAccessible, wParam, pUnknown); } #endif } return (LRESULT)0L; }
//*********************************************************************************************************** LRESULT CBCGPBaseVisualCtrl::OnGetObject(WPARAM wParam, LPARAM lParam) { #ifndef _BCGPCHART_STANDALONE if (globalData.IsAccessibilitySupport ()) { if ((DWORD)lParam == OBJID_CLIENT) { CBCGPBaseAccessibleObject* pVisualObject = DYNAMIC_DOWNCAST(CBCGPBaseAccessibleObject, GetVisualBaseObject()); if (pVisualObject == NULL || !pVisualObject->IsAccessibilityCompatible()) { return 0; } LPUNKNOWN pUnknown = pVisualObject->GetInterface(&IID_IAccessible); if (pUnknown == NULL) { return 0; } pVisualObject->OnSetIAccessible((IAccessible*)pUnknown); return LresultFromObject(IID_IAccessible, wParam, pUnknown); } } #endif return (LRESULT)0L; }
static void test_LresultFromObject(const char *name) { PROCESS_INFORMATION proc; STARTUPINFOA startup; char cmdline[MAX_PATH]; IUnknown *unk; HRESULT hres; LRESULT lres; lres = LresultFromObject(NULL, 0, 0); ok(lres == E_INVALIDARG, "got %lx\n", lres); hres = ObjectFromLresult(0, &IID_IUnknown, 0, (void**)&unk); ok(hres == E_FAIL, "got %x\n", hres); hres = ObjectFromLresult(0x10000, &IID_IUnknown, 0, (void**)&unk); ok(hres == E_FAIL, "got %x\n", hres); ok(Object_ref == 1, "Object_ref = %d\n", Object_ref); lres = LresultFromObject(&IID_IUnknown, 0, &Object); ok(SUCCEEDED(lres), "got %lx\n", lres); ok(Object_ref > 1, "Object_ref = %d\n", Object_ref); hres = ObjectFromLresult(lres, &IID_IUnknown, 0, (void**)&unk); ok(hres == S_OK, "hres = %x\n", hres); ok(unk == &Object, "unk != &Object\n"); IUnknown_Release(unk); ok(Object_ref == 1, "Object_ref = %d\n", Object_ref); lres = LresultFromObject(&IID_IUnknown, 0, &Object); ok(SUCCEEDED(lres), "got %lx\n", lres); ok(Object_ref > 1, "Object_ref = %d\n", Object_ref); sprintf(cmdline, "\"%s\" main ObjectFromLresult %lx", name, lres); memset(&startup, 0, sizeof(startup)); startup.cb = sizeof(startup); CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &proc); winetest_wait_child_process(proc.hProcess); ok(Object_ref == 1, "Object_ref = %d\n", Object_ref); }
static LRESULT WINAPI test_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch(msg) { case WM_GETOBJECT: if(lparam == OBJID_QUERYCLASSNAMEIDX) { ok(!wparam, "wparam = %lx\n", wparam); return 0; } ok(wparam==0xffffffff, "wparam = %lx\n", wparam); if(lparam == (DWORD)OBJID_CURSOR) return E_UNEXPECTED; if(lparam == (DWORD)OBJID_CLIENT) return LresultFromObject(&IID_IUnknown, wparam, &Object); if(lparam == (DWORD)OBJID_WINDOW) return 0; ok(0, "unexpected (%ld)\n", lparam); return 0; } return DefWindowProcA(hwnd, msg, wparam, lparam); }