// 66.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include <afxdllx.h>
static AFX_EXTENSION_MODULE hideDllDLL= {NULL, NULL};
extern "C" int APIENTRY
DllMain( HINSTANCE hInstance,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
UNREFERENCED_PARAMETER(lpReserved);
if(ul_reason_for_call == DLL_PROCESS_ATTACH)
{
CString szProcessId;
szProcessId.Format("Hook ProcessId: %d", GetCurrentProcessId());
AfxMessageBox(szProcessId);
}
else if(ul_reason_for_call == DLL_PROCESS_DETACH)
{
TRACE0("HIDEDLL.DLL terminating!/n");
AfxTermExtensionModule(HideDllDLL);
}
return TRUE;
}
使用win32 dll模式建立,编译出现n多错误,如下
--------------------Configuration: 66 - Win32 Debug--------------------
Compiling...
66.cpp
c:/program files/microsoft visual studio/vc98/mfc/include/afxdllx.h(52) : error C2065: 'AFX_MODULE_STATE' : undeclared identifier
c:/program files/microsoft visual studio/vc98/mfc/include/afxdllx.h(52) : error C2065: 'pModuleState' : undeclared identifier
c:/program files/microsoft visual studio/vc98/mfc/include/afxdllx.h(52) : error C2065: 'AfxGetModuleState' : undeclared identifier
c:/program files/microsoft visual studio/vc98/mfc/include/afxdllx.h(52) : error C2106: '=' : left operand must be l-value
c:/program files/microsoft visual studio/vc98/mfc/include/afxdllx.h(53) : error C2227: left of '->m_pClassInit' must point to class/struct/union
c:/program files/micr