All pastes #744581 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-10-21 16:53 UTC
rendered paste body
#include <windows.h>

#include "D2Functions.h"

DWORD threadId;
HANDLE thread;

DWORD WINAPI ThreadProc(LPVOID lpParameter)
{
	bool isActive = false;

	while(true)
	{
 if(isActive == true)
 {
 	SleepEx(5000, true);
 	isActive = false;
 }

 if(GetCurrentLife() < 20)
 {
 	isActive = true;
 	
 	PrintMessage("Warning! You have under 20 life remaining.", 1);
 }
	}
	return 0;
}

BOOL WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
{
	thread = CreateThread(0, 0, ThreadProc, 0, 0, &threadId);
	switch(dwReason)
	{
	case DLL_PROCESS_ATTACH:
 PrintMessage("...", 4);
 break;
	case DLL_PROCESS_DETACH:
 break;
	case DLL_THREAD_ATTACH:
 break;
	case DLL_THREAD_DETACH:
 break;
	default: {}
 break;
	}
	return TRUE;
}