控制台重定义代码
FILE* pfile = NULL;
//重定向到标准输出
errno_t iret = freopen_s(&pfile, "CONOUT$", "w", stdout);
防止卡代码注入器
::CreateThread(0, 0, 线程函数, 0, 0,0);
DWORD WINAPI 线程函数(LPVOID arg);
自动释放DLL
FreeLibraryAndExitThread(theApp.m_hInstance, 123);
2.定时器
SetTimer函数的原型
UINT_PTR SetTimer(
HWND hWnd, // 窗口句柄
UINT_PTR 定时器ID, // 定时器ID,多个定时器时,可以通过该ID判断是哪个定时器
UINT nElapse, // 时间间隔,单位为毫秒
TIMERPROC lpTimerFunc // 回调函数
);
//定时器回调
void CALLBACK TimerProc(HWND hWnd,UINT nMsg,UINT_PTR 定时器ID,DWORD dwTime);
//关闭定时器
void KillTimer(HWND hWnd,UINT 定时器ID);