在你的DllMain中进行设置BOOL WINAPI DllMain( HINSTANCE hinstDLL, // handle to DLL module DWORD fdwReason, // reason for calling function LPVOID lpReserved ) // reserved { // Perform actions based on the reason for calling. switch( fdwReason ) { case DLL_PROCESS_ATTACH: // Initialize once for each new process. // Return FALSE to fail DLL load. break; case DLL_THREAD_ATTACH: // Do thread-specific initialization. break; case DLL_THREAD_DETACH: // Do thread-specific cleanup. break; case DLL_PROCESS_DETACH: // Perform any necessary cleanup. break; } return TRUE; // Successful DLL_PROCESS_ATTACH. }
通过共享数据段共享数据 data_seg
To jiangsheng(蒋晟.MSMVP2004Jan): 共享数据段不符合我的要求,麻烦您看看下面的连接好吗?http://community.csdn.net/Expert/topic/3907/3907722.xml?temp=.7537042
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpReserved ) // reserved
{
// Perform actions based on the reason for calling.
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
break; case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break; case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break; case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
共享数据段不符合我的要求,麻烦您看看下面的连接好吗?http://community.csdn.net/Expert/topic/3907/3907722.xml?temp=.7537042