Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Fri, 1 Feb 2008 05:18:35 +0800,    group: microsoft.public.inetsdk.programming.webbrowser_ctl        back       


about window.external and type library   
i have made a COM object to be called from 'window.external'.
it seems i have to reg the type library to the registry.
my question is can i implement some interfaces to avoid this.
i mean the IE direct get type info from my code instead of
from the reg.


thx~
date: Fri, 1 Feb 2008 05:18:35 +0800   author:   susan

Re: about window.external and type library   
susan wrote:
> i have made a COM object to be called from 'window.external'.
> it seems i have to reg the type library to the registry.
> my question is can i implement some interfaces to avoid this.

Are you using ATL's IDispatchImpl to implement IDispatch for your 
object, by any chance? If so, simply specify 0xFFFF for wMajor and 
wMinor template parameters. You would still need to build the type 
library and bind it to your application as a resource, but you won't 
have to register it.

> i mean the IE direct get type info from my code instead of
> from the reg.

IE doesn't use your type library at all, it just calls 
IDispatch::Invoke. IDispatchImpl needs the type library to translate 
Invoke calls into actual method calls.
-- 
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
date: Thu, 31 Jan 2008 16:44:00 -0500   author:   Igor Tandetnik

Re: about window.external and type library   
it seems just disable he LoadRegTypeLib call.
can i use LoadTypeLibEx instead of the LoadRegTypeLib?


"Igor Tandetnik"  дÈëÏûÏ¢ 
news:eZRzkJFZIHA.4324@TK2MSFTNGP03.phx.gbl...
> susan wrote:
>> i have made a COM object to be called from 'window.external'.
>> it seems i have to reg the type library to the registry.
>> my question is can i implement some interfaces to avoid this.
>
> Are you using ATL's IDispatchImpl to implement IDispatch for your object, 
> by any chance? If so, simply specify 0xFFFF for wMajor and wMinor template 
> parameters. You would still need to build the type library and bind it to 
> your application as a resource, but you won't have to register it.
>
>> i mean the IE direct get type info from my code instead of
>> from the reg.
>
> IE doesn't use your type library at all, it just calls IDispatch::Invoke. 
> IDispatchImpl needs the type library to translate Invoke calls into actual 
> method calls.
> -- 
> 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
>
>
date: Sun, 3 Feb 2008 08:05:26 +0800   author:   susan

Re: about window.external and type library   
<susan> wrote in message
news:9087B8D0-69BE-4FD2-BB46-24E5368EBAC3@microsoft.com
> 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
date: Sat, 2 Feb 2008 20:33:35 -0500   author:   Igor Tandetnik

Re: about window.external and type library   
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"  дÈëÏûÏ¢ 
news:#gemNTgZIHA.4696@TK2MSFTNGP05.phx.gbl...
> <susan> wrote in message
> news:9087B8D0-69BE-4FD2-BB46-24E5368EBAC3@microsoft.com
>> 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
>
date: Sun, 3 Feb 2008 22:21:24 +0800   author:   susan

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us