终于找到了.不敢独享.
MFC 写的ActiveX 的修改.或者参照:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaxctrl/html/msdn_abcsmfc.asp//具体修改内容
/*--------------------------C****Ctrl.cpp-------------------------*/
#include "helpers.h"  //文件内容再下面
#include <objsafe.h>BOOL C****Ctrl::C****CtrlFactory::UpdateRegistry(BOOL bRegister)
{
// TODO: Verify that your control follows apartment-model threading rules.
// Refer to MFC TechNote 64 for more information.
// If your control does not conform to the apartment-model rules, then
// you must modify the code below, changing the 6th parameter from
// afxRegApartmentThreading to 0. if (bRegister){
BOOL retval =  AfxOleRegisterControlClass(
AfxGetInstanceHandle(),
m_clsid,
m_lpszProgID,
IDS_MFCSAFE,
IDB_MFCSAFE,
afxRegApartmentThreading,
_dwMfcsafeOleMisc,
_tlid,
_wVerMajor,
_wVerMinor);
HRESULT hr = CreateComponentCategory(CATID_SafeForScripting, 
L"Controls that are safely scriptable");
/*------------------------Safe--------------------------*/
if (SUCCEEDED(hr))
// only register if category exists
RegisterCLSIDInCategory(m_clsid, CATID_SafeForScripting);
// don't care if this call fails //  as safe for data initialization
hr = CreateComponentCategory(CATID_SafeForInitializing, 
L"Controls safely initializable from persistent data"); if (SUCCEEDED(hr))
// only register if category exists
RegisterCLSIDInCategory(m_clsid, CATID_SafeForInitializing);
// don't care if this call fails return retval;
/*------------------------Safe--------------------------*/
}
else
return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
}/*--------------------------****Ctrl.cpp-------------------------*/
/*-------------------------helpers.h----------------------------*/
// Helpers.h : Declarations of object safety category helper functions#include "comcat.h"HRESULT CreateComponentCategory(CATID catid, WCHAR* catDescription);
HRESULT RegisterCLSIDInCategory(REFCLSID clsid, CATID catid);
/*-------------------------helpers.h----------------------------*//*-------------------------helpers.cpp----------------------------*/// Helpers.cpp : Implementation of of object safety category helper functions
// Copied from ActiveX SDK#include "stdafx.h"#include "helpers.h"/////////////////////////////////////////////////////////////////////////////
// CreateComponentCategory - Ensures component category exists in registry
// (Copied from ActiveX SDK docs)HRESULT CreateComponentCategory(CATID catid, WCHAR* catDescription)
{    ICatRegister* pcr = NULL ; // interface pointer
    HRESULT hr = S_OK ;    hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, 
NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr);
if (FAILED(hr))
return hr;    // Make sure the HKCR\Component Categories\{..catid...}
    // key is registered
    CATEGORYINFO catinfo;
    catinfo.catid = catid;
    catinfo.lcid = 0x0409 ; // english // Make sure the provided description is not too long.
// Only copy the first 127 characters if it is
int len = wcslen(catDescription);
if (len>127)
len = 127;
    wcsncpy(catinfo.szDescription, catDescription, len);
// Make sure the description is null terminated
catinfo.szDescription[len] = '\0';    hr = pcr->RegisterCategories(1, &catinfo);
pcr->Release(); return hr;
}/////////////////////////////////////////////////////////////////////////////
// RegisterCLSIDInCategory - Registers class clsid as implementing category catid
// (Copied from ActiveX SDK docs)HRESULT RegisterCLSIDInCategory(REFCLSID clsid, CATID catid)
{
// Register your component categories information.
    ICatRegister* pcr = NULL ;
    HRESULT hr = S_OK ;
    hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, 
NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr);
    if (SUCCEEDED(hr))
    {
       // Register this category as being "implemented" by
       // the class.
       CATID rgcatid[1] ;
       rgcatid[0] = catid;
       hr = pcr->RegisterClassImplCategories(clsid, 1, rgcatid);
    }    if (pcr != NULL)
        pcr->Release();
  
return hr;
}/*-------------------------helpers.cpp----------------------------*/