Back to index

lightning-sunbird  0.9+nobinonly
XPCDispUtilities.h
Go to the documentation of this file.
00001 #ifndef XPCDispUtilities_h
00002 #define XPCDispUtilities_h
00003 
00004 template <class T>
00005 inline
00006 HRESULT XPCCreateInstance(const CLSID & clsid, const IID & iid, T ** result)
00007 {
00008     return CoCreateInstance(clsid, 0, CLSCTX_ALL, iid, reinterpret_cast<void**>(result));
00009 }
00010 
00011 DISPID GetIDsOfNames(IDispatch * pIDispatch , CComBSTR const & name)
00012 {
00013     DISPID dispid;
00014     OLECHAR * pName = name;
00015     HRESULT hresult = pIDispatch->GetIDsOfNames(
00016         IID_NULL,
00017         &pName,
00018         1, 
00019         LOCALE_SYSTEM_DEFAULT,
00020         &dispid);
00021     if (!SUCCEEDED(hresult))
00022     {
00023         dispid = 0;
00024     }
00025     return dispid;
00026 }
00027 
00028 #endif