資源簡介
使用VS2012窗口示例代碼,具有網(wǎng)頁調(diào)用的外部接口,同時(shí)實(shí)現(xiàn)推送給網(wǎng)頁的消息。具體說明請參考:
https://blog.csdn.net/ptrunner/article/details/88971813
代碼片段和文件信息
//?MFCActiveXControl1.cpp?:?CMFCActiveXControl1App?和?DLL?注冊的實(shí)現(xiàn)。
#include?“stdafx.h“
#include?“MFCActiveXControl1.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#endif
CMFCActiveXControl1App?theApp;
const?GUID?CDECL?_tlid?=?{?0xE976D19A?0xD0DA?0x4DFE?{?0xAC?0x83?0xC1?0x55?0xAB?0xE?0xE7?0xC9?}?};
const?WORD?_wVerMajor?=?1;
const?WORD?_wVerMinor?=?0;
//?CMFCActiveXControl1App::InitInstance?-?DLL?初始化
BOOL?CMFCActiveXControl1App::InitInstance()
{
BOOL?bInit?=?COleControlModule::InitInstance();
if?(bInit)
{
//?TODO:?在此添加您自己的模塊初始化代碼。
}
return?bInit;
}
//?CMFCActiveXControl1App::ExitInstance?-?DLL?終止
int?CMFCActiveXControl1App::ExitInstance()
{
//?TODO:?在此添加您自己的模塊終止代碼。
return?COleControlModule::ExitInstance();
}
//?DllRegisterServer?-?將項(xiàng)添加到系統(tǒng)注冊表
STDAPI?DllRegisterServer(void)
{
AFX_MANAGE_STATE(_afxModuleAddrThis);
if?(!AfxOleRegisterTypeLib(AfxGetInstanceHandle()?_tlid))
return?ResultFromScode(SELFREG_E_TYPELIB);
if?(!COleobjectFactoryEx::UpdateRegistryAll(TRUE))
return?ResultFromScode(SELFREG_E_CLASS);
return?NOERROR;
}
//?DllUnregisterServer?-?將項(xiàng)從系統(tǒng)注冊表中移除
STDAPI?DllUnregisterServer(void)
{
AFX_MANAGE_STATE(_afxModuleAddrThis);
if?(!AfxOleUnregisterTypeLib(_tlid?_wVerMajor?_wVerMinor))
return?ResultFromScode(SELFREG_E_TYPELIB);
if?(!COleobjectFactoryEx::UpdateRegistryAll(FALSE))
return?ResultFromScode(SELFREG_E_CLASS);
return?NOERROR;
}
評論
共有 條評論