mapi32: Add support to MAPISendMailW for ANSI fallback.
[wine/multimedia.git] / dlls / strmbase / dispatch.c
blob59ac99d394db61a7559bce6ed490e628e5278323
1 /*
2 * Generic Implementation of IDispatch for strmbase classes
4 * Copyright 2012 Aric Stewart, CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include "dshow.h"
24 #include "wine/debug.h"
25 #include "wine/unicode.h"
26 #include "wine/strmbase.h"
27 #include "uuids.h"
28 #include "vfwmsgs.h"
29 #include <assert.h>
31 WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
33 HRESULT WINAPI BaseDispatch_Init(BaseDispatch *This, REFIID riid)
35 HRESULT hr = E_FAIL;
36 ITypeLib *pTypeLib;
38 This->pTypeInfo = NULL;
39 hr = LoadRegTypeLib(&LIBID_QuartzTypeLib, 1, 0, LOCALE_SYSTEM_DEFAULT, &pTypeLib);
40 if (SUCCEEDED(hr))
42 hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, riid, &This->pTypeInfo);
44 if (pTypeLib)
45 ITypeLib_Release(pTypeLib);
47 return hr;
50 HRESULT WINAPI BaseDispatch_Destroy(BaseDispatch *This)
52 if (This->pTypeInfo)
53 ITypeInfo_Release(This->pTypeInfo);
54 return S_OK;
57 HRESULT WINAPI BaseDispatchImpl_GetIDsOfNames(BaseDispatch *This, REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
59 if (This->pTypeInfo)
60 return ITypeInfo_GetIDsOfNames(This->pTypeInfo, rgszNames, cNames, rgdispid);
61 return E_NOTIMPL;
64 HRESULT WINAPI BaseDispatchImpl_GetTypeInfo(BaseDispatch *This, REFIID riid, UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
66 if (This->pTypeInfo)
68 ITypeInfo_AddRef(This->pTypeInfo);
69 *pptinfo = This->pTypeInfo;
70 return S_OK;
72 return E_NOTIMPL;
75 HRESULT WINAPI BaseDispatchImpl_GetTypeInfoCount(BaseDispatch *This, UINT *pctinfo)
77 if (This->pTypeInfo)
78 *pctinfo = 1;
79 else
80 *pctinfo = 0;
81 return S_OK;