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

推荐订阅源

Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
N
News | PayPal Newsroom
S
Security @ Cisco Blogs
Schneier on Security
Schneier on Security
V
V2EX - 技术
S
Secure Thoughts
W
WeLiveSecurity
Google DeepMind News
Google DeepMind News
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
S
Securelist
S
Security Archives - TechRepublic
Know Your Adversary
Know Your Adversary
V
Vulnerabilities – Threatpost
Security Latest
Security Latest
Recent Commits to openclaw:main
Recent Commits to openclaw:main
G
GRAHAM CLULEY
H
Hacker News: Front Page
Microsoft Azure Blog
Microsoft Azure Blog
I
Intezer
Google Online Security Blog
Google Online Security Blog
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
T
The Exploit Database - CXSecurity.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Webroot Blog
Webroot Blog
Jina AI
Jina AI
Engineering at Meta
Engineering at Meta
P
Proofpoint News Feed
The Cloudflare Blog
I
InfoQ
L
LangChain Blog
U
Unit 42
P
Proofpoint News Feed
S
Schneier on Security
S
Security Affairs
Y
Y Combinator Blog
T
Tenable Blog
N
News and Events Feed by Topic
MyScale Blog
MyScale Blog
量子位
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
博客园 - 聂微东
D
Darknet – Hacking Tools, Hacker News & Cyber Security
GbyAI
GbyAI
AWS News Blog
AWS News 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