Re: about window.external and type library
- From: <susan>
- Date: Sun, 3 Feb 2008 22:21:24 +0800
sorry,Igor. i forgot to tell u i'm using ATL3/WTL8 now. :(
any way,i know i can overload GetTI in ATL3 to do this.
thank u :)
inline HRESULT CComTypeInfoHolder::GetTI(LCID lcid)
{
//If this assert occurs then most likely didn't initialize properly
ATLASSERT(m_plibid != NULL && m_pguid != NULL);
ATLASSERT(!InlineIsEqualGUID(*m_plibid, GUID_NULL) && "Did you forget to pass the LIBID to CComModule::Init?");
if (m_pInfo != NULL)
return S_OK;
HRESULT hRes = E_FAIL;
EnterCriticalSection(&_Module.m_csTypeInfoHolder);
if (m_pInfo == NULL)
{
ITypeLib* pTypeLib;
hRes = LoadRegTypeLib(*m_plibid, m_wMajor, m_wMinor, lcid, &pTypeLib);
if (SUCCEEDED(hRes))
{
CComPtr<ITypeInfo> spTypeInfo;
hRes = pTypeLib->GetTypeInfoOfGuid(*m_pguid, &spTypeInfo);
if (SUCCEEDED(hRes))
{
CComPtr<ITypeInfo> spInfo(spTypeInfo);
CComPtr<ITypeInfo2> spTypeInfo2;
if (SUCCEEDED(spTypeInfo->QueryInterface(&spTypeInfo2)))
spInfo = spTypeInfo2;
LoadNameCache(spInfo);
m_pInfo = spInfo.Detach();
}
pTypeLib->Release();
}
}
else
{
hRes = S_OK;
}
LeaveCriticalSection(&_Module.m_csTypeInfoHolder);
_Module.AddTermFunc(Cleanup, (DWORD)this);
return hRes;
}
"Igor Tandetnik" <itandetnik@xxxxxxxx> 写入消息 news:#gemNTgZIHA.4696@xxxxxxxxxxxxxxxxxxxxxxx
<susan> wrote in message.
news:9087B8D0-69BE-4FD2-BB46-24E5368EBAC3@xxxxxxxxxxxxx
it seems just disable he LoadRegTypeLib call.
can i use LoadTypeLibEx instead of the LoadRegTypeLib?
IDispatchImpl does use LoadTypeLib in lieu of LoadRegTypeLib when you specify those special values for wMajor and wMinor. See CComTypeInfoHolder::GetTI in altcom.h (line 3664 in the version shipped with VC7.1)
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
- References:
- Re: about window.external and type library
- From: susan
- Re: about window.external and type library
- From: Igor Tandetnik
- Re: about window.external and type library
- Prev by Date: Open in the same window
- Next by Date: Re: Open in the same window
- Previous by thread: Re: about window.external and type library
- Next by thread: Open in the same window
- Index(es):