#include <windows.h>
BOOL APIENTRY DllMain(HMODULE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
OutputDebugString(TEXT("加载dll"));
}
break;
case DLL_THREAD_ATTACH:
{
OutputDebugString(TEXT("新建线程"));
}
break;
case DLL_THREAD_DETACH:
{
OutputDebugString(TEXT("线程退出"));
}
break;
case DLL_PROCESS_DETACH:
{
OutputDebugString(TEXT("释放dll"));
}
break;
}
return TRUE;
}
bool dllmainMsg(void)
{
MSG msg;
// PeekMessage 强制系统为该线程建立消息栈
PeekMessage(&msg, NULL, NULL, NULL, FALSE);
while (GetMessage(&msg, NULL, NULL, NULL))
{
switch (msg.message)
{
case WM_TIMER:
{
// 这里每1秒钟执行一次
OutputDebugString(TEXT("2222"));
}
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
dllmain
最新推荐文章于 2021-10-01 21:57:25 发布