惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
I
InfoQ
B
Blog RSS Feed
D
DataBreaches.Net
S
SegmentFault 最新的问题
P
Proofpoint News Feed
A
About on SuperTechFans
WordPress大学
WordPress大学
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
小众软件
小众软件
博客园 - Franky
有赞技术团队
有赞技术团队
D
Docker
T
Tailwind CSS Blog
雷峰网
雷峰网
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Blog — PlanetScale
Blog — PlanetScale
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog
V
Visual Studio Blog
宝玉的分享
宝玉的分享
爱范儿
爱范儿

博客园 - 转角遇到你

SQL安装问题:SQL Redist ANSI 和 UNICODE 的函数对应表【转】 wchar_t*,wchar_t,wchat_t数组,char,char*,char数组,std::string,std::wstring,CString转自由骑士大哥 [转]宽字符处理函数函数与普通函数对照表 cad pk Microstation LPCTSTR类型 UNICODE下宽字符的CString转换为const char * Windows应用程序中几种特殊鼠标事件的识别【转】 在C++ 程序中调用被C 编译器编译后的函数,为什么要加extern “C”?----转 [转] #ifndef#define#endif的用法(整理) cximage用的过程中的错误 【转】三维形体模型的表示 AutoCAD的坐标系 AutoCAD数据库小记 两个不同的类相互引用的情况下头文件包含问题 ctabctrl insertitem 报Debug Assertion Failed arx 打开实体对象方式 error LNK2001: unresolved external symbol __endthreadex 最小二乘法
com基于mfc和非mfc的区别
转角遇到你 · 2008-03-06 · via 博客园 - 转角遇到你

基于非mfc的组件的主函数为:

/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point

extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID 
/*lpReserved*/)
{
    
if (dwReason == DLL_PROCESS_ATTACH)
    
{
        _Module.Init(ObjectMap, hInstance, 
&LIBID_TESTALib);
        DisableThreadLibraryCalls(hInstance);
    }

    
else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    
return TRUE;    // ok
}


/////////////////////////////////////////////////////////////////////////////

基于mfc的组件主函数为:

/////////////////////////////////////////////////////////////////////////////
class CTestBApp : public CWinApp
{
public:

// Overrides
    
// ClassWizard generated virtual function overrides
    
//{{AFX_VIRTUAL(CTestBApp)
    public:
    
virtual BOOL InitInstance();
    
virtual int ExitInstance();
    
//}}AFX_VIRTUAL

    
//{{AFX_MSG(CTestBApp)
        
// NOTE - the ClassWizard will add and remove member functions here.
        
//    DO NOT EDIT what you see in these blocks of generated code !
    
//}}AFX_MSG
    DECLARE_MESSAGE_MAP()
}
;

BEGIN_MESSAGE_MAP(CTestBApp, CWinApp)
    
//{{AFX_MSG_MAP(CTestBApp)
        
// NOTE - the ClassWizard will add and remove mapping macros here.
        
//    DO NOT EDIT what you see in these blocks of generated code!
    
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

CTestBApp theApp;

BOOL CTestBApp::InitInstance()
{
    _Module.Init(ObjectMap, m_hInstance, 
&LIBID_TESTBLib);
    
return CWinApp::InitInstance();
}


int CTestBApp::ExitInstance()
{
    _Module.Term();
    
return CWinApp::ExitInstance();
}


/////////////////////////////////////////////////////////////////////////////

如果需要从非mfc组件改成mfc组件,可以参考文章:HOWTO: 给 ATL 项目添加 MFC 支持,以下为链接地址

http://support.microsoft.com/kb/173974/zh-cn