#include <Windows.h>
#include <iostream>
#include <Shlwapi.h>
int GetOffset(const char* ModuleName, int Offset) {
	HMODULE base = GetModuleHandleA(ModuleName);
	return (DWORD)base+Offset;
}

void DoEvents()
{
	MSG msg;
	BOOL result;

	while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
	{
		result = ::GetMessage(&msg, NULL, 0, 0);
		if (result == 0) // WM_QUIT
		{
			::PostQuitMessage(msg.wParam);
			break;
		}
		else if (result == -1)
		{
			// Handle errors/exit application, etc.
		}
		else
		{
			::TranslateMessage(&msg);
			::DispatchMessage(&msg);
		}
	}
}


unsigned long fsize(FILE* f)
{
	fseek(f, 0, SEEK_END);
	unsigned long len = (unsigned long)ftell(f);
	return len;
}