static HRESULT WINAPI ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid, void** ppvObject) { IRichEditOleImpl *This = impl_from_ITextDocument(me); return IRichEditOle_QueryInterface(&This->IRichEditOle_iface, riid, ppvObject); }
static void create_interfaces(HWND *w, IRichEditOle **reOle, ITextDocument **txtDoc, ITextSelection **txtSel) { *w = new_richedit(NULL); SendMessageA(*w, EM_GETOLEINTERFACE, 0, (LPARAM)reOle); IRichEditOle_QueryInterface(*reOle, &IID_ITextDocument, (void **) txtDoc); ITextDocument_GetSelection(*txtDoc, txtSel); }
static void test_Interfaces(void) { IRichEditOle *reOle = NULL; ITextDocument *txtDoc = NULL; ITextSelection *txtSel = NULL; IUnknown *punk; HRESULT hres; LRESULT res; HWND w; w = new_richedit(NULL); if (!w) { skip("Couldn't create window\n"); return; } res = SendMessageA(w, EM_GETOLEINTERFACE, 0, (LPARAM)&reOle); ok(res, "SendMessage\n"); ok(reOle != NULL, "EM_GETOLEINTERFACE\n"); hres = IRichEditOle_QueryInterface(reOle, &IID_ITextDocument, (void **) &txtDoc); ok(hres == S_OK, "IRichEditOle_QueryInterface\n"); ok(txtDoc != NULL, "IRichEditOle_QueryInterface\n"); ITextDocument_GetSelection(txtDoc, &txtSel); punk = NULL; hres = ITextSelection_QueryInterface(txtSel, &IID_ITextSelection, (void **) &punk); ok(hres == S_OK, "ITextSelection_QueryInterface\n"); ok(punk != NULL, "ITextSelection_QueryInterface\n"); IUnknown_Release(punk); punk = NULL; hres = ITextSelection_QueryInterface(txtSel, &IID_ITextRange, (void **) &punk); ok(hres == S_OK, "ITextSelection_QueryInterface\n"); ok(punk != NULL, "ITextSelection_QueryInterface\n"); IUnknown_Release(punk); punk = NULL; hres = ITextSelection_QueryInterface(txtSel, &IID_IDispatch, (void **) &punk); ok(hres == S_OK, "ITextSelection_QueryInterface\n"); ok(punk != NULL, "ITextSelection_QueryInterface\n"); IUnknown_Release(punk); ITextDocument_Release(txtDoc); IRichEditOle_Release(reOle); DestroyWindow(w); /* Methods should return CO_E_RELEASED if the backing document has been released. One test should suffice. */ hres = ITextSelection_CanEdit(txtSel, NULL); ok(hres == CO_E_RELEASED, "ITextSelection after ITextDocument destroyed\n"); ITextSelection_Release(txtSel); }