CComPtr<IClassFactory> m_spCF;
CComPtr<IInternetSession> spSession;
		hr  = CoInternetGetSession(0, &spSession, 0);
		if (SUCCEEDED(hr))
		{
			m_spCF.CoCreateInstance(CLSID_ProtocolHandlerCF);
			if(SUCCEEDED(hr))
			{
				hr = spSession->RegisterNameSpace(m_spCF, CLSID_NULL, L"http", 0,
0, 0);
			}
		}
This works fine but when I run it gives me error and IE exists.
Error is
---------------------------
Windows Internet Explorer
---------------------------
Internet Explorer cannot download fwlink/ from go.microsoft.com.
The application called an interface that was marshalled for a
different thread.
---------------------------
OK
---------------------------
AS per my understanding , BHO is launched by IE and APP is created by
BHO.
Both BHO and APP are in same dll. Is there any issue with this? Am I
doing something wrong..
URLMon doesn't follow COM rules and freely passes interface pointers 
between threads. This only works as long as they are all direct 
pointers. Somehow, you've gotten a proxy pointer in there, and the proxy 
complains about being called from the wrong thread.
Say, what threading model is CLSID_ProtocolHandlerCF coclass registered 
with? Not free-threaded, by any chance?
-- 
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