/****************************************************************** * CreateTextServices (RICHED20.4) */ HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter, ITextHost * pITextHost, IUnknown **ppUnk) { ITextServicesImpl *ITextImpl; HRESULT hres; TRACE("%p %p --> %p\n", pUnkOuter, pITextHost, ppUnk); if (pITextHost == NULL) return E_POINTER; ITextImpl = CoTaskMemAlloc(sizeof(*ITextImpl)); if (ITextImpl == NULL) return E_OUTOFMEMORY; InitializeCriticalSection(&ITextImpl->csTxtSrv); ITextImpl->csTxtSrv.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ITextServicesImpl.csTxtSrv"); ITextImpl->ref = 1; ITextHost_AddRef(pITextHost); ITextImpl->pMyHost = pITextHost; ITextImpl->lpVtbl = &textservices_Vtbl; ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE); ITextImpl->editor->exStyleFlags = 0; ITextImpl->editor->rcFormat = (RECT) { 0,0,0,0 }; ME_HandleMessage(ITextImpl->editor, WM_CREATE, 0, 0, TRUE, &hres); if (pUnkOuter) { FIXME("Support aggregation\n"); return CLASS_E_NOAGGREGATION; } *ppUnk = (IUnknown *)ITextImpl; return S_OK; }
/****************************************************************** * CreateTextServices (RICHED20.4) */ HRESULT WINAPI CreateTextServices(IUnknown *pUnkOuter, ITextHost *pITextHost, IUnknown **ppUnk) { ITextServicesImpl *ITextImpl; HRESULT hres; TRACE("%p %p --> %p\n", pUnkOuter, pITextHost, ppUnk); if (pITextHost == NULL) return E_POINTER; ITextImpl = CoTaskMemAlloc(sizeof(*ITextImpl)); if (ITextImpl == NULL) return E_OUTOFMEMORY; InitializeCriticalSection(&ITextImpl->csTxtSrv); ITextImpl->csTxtSrv.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ITextServicesImpl.csTxtSrv"); ITextImpl->ref = 1; ITextHost_AddRef(pITextHost); ITextImpl->pMyHost = pITextHost; ITextImpl->IUnknown_inner.lpVtbl = &textservices_inner_vtbl; ITextImpl->ITextServices_iface.lpVtbl = &textservices_vtbl; ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE); ITextImpl->editor->exStyleFlags = 0; ITextImpl->editor->rcFormat.left = 0; ITextImpl->editor->rcFormat.top = 0; ITextImpl->editor->rcFormat.right = 0; ITextImpl->editor->rcFormat.bottom = 0; ME_HandleMessage(ITextImpl->editor, WM_CREATE, 0, 0, TRUE, &hres); if (pUnkOuter) ITextImpl->outer_unk = pUnkOuter; else ITextImpl->outer_unk = &ITextImpl->IUnknown_inner; *ppUnk = &ITextImpl->IUnknown_inner; return S_OK; }
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *plresult) { ITextServicesImpl *This = impl_from_ITextServices(iface); HRESULT hresult; LRESULT lresult; lresult = ME_HandleMessage(This->editor, msg, wparam, lparam, TRUE, &hresult); if (plresult) *plresult = lresult; return hresult; }
HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam, LPARAM lparam, LRESULT* plresult) { ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); HRESULT hresult; LRESULT lresult; lresult = ME_HandleMessage(This->editor, msg, wparam, lparam, TRUE, &hresult); if (plresult) *plresult = lresult; return hresult; }