初学ATL...从头开始吧
<B>#include <shlobj.h>
#include <comdef.h></B>
class ATL_NO_VTABLE CDLLRegShlExt :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CDLLRegShlExt, &CLSID_DllRegShlExt>,
<STRIKE>public IDllRegShlExt,</STRIKE>
<B>public IShellExtInit</B>
{
BEGIN_COM_MAP(CDLLRegShlExt)
<STRIKE>COM_INTERFACE_ENTRY(IDllRegShlExt)</STRIKE>
<B>COM_INTERFACE_ENTRY(IShellExtInit)</B>
END_COM_MAP()
template<
class ThreadModel
>
class CComObjectRootEx : public CComObjectRootBase
这里CComObjectRootEx是一个ATL的类
我看来大概是管理Com对象的一个类,是搞计数的吧,一个实现COM的类必须要继承它的
它还是个模板类,模板参数是ThreadModel:
CComSingleThreadModel, CComMultiThreadModel, or CComMultiThreadModelNoCS. You can accept the server's default thread model by setting ThreadModel to CComObjectThreadModel or CComGlobalsThreadModel
A class that implements a COM server must inherit from CComObjectRootEx or CComObjectRoot.
template<
class T,
const CLSID* pclsid = &CLSID_NULL
>
class CComCoClass
CComCoClass的类应该之前
继续加一些新的东西 看MSDN Magzine 关于COM的东西,提到一些对于rgs注册脚本的使用前提
Way back in the November and December 1999 issues of Microsoft Systems Journal (now known as MSDN®Magazine), I showed how to build a Band Object for Internet Explorer using the Active Template Library (ATL) IRegistrar interface. (Band Objects need to register a special category CATID_DeskBand.) IRegistrar is a really cool tool that lets you write a registration script (.RGS file) to add your registry entries, instead of calling registry functions like RegOpenKey, RegSetValue, and the rest. Figure 1 shows a typical script.
这一段讲IRegistrar接口的作用,hoho