Exemple #1
0
/*
MAIN - EINSTIEGSPUNKT
*/
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	HANDLE hMutex = CreateMutex(NULL, true, TRAINERNAME);

	if (GetLastError() == ERROR_ALREADY_EXISTS || hMutex == INVALID_HANDLE_VALUE)
		return FALSE;

	g_hInstance = hInstance;

	// "Software\\Nadeo\\TMUltraTrainer"
	Registration::SetSavePath("Software\\Nadeo\\TMUltraTrainer");

	if (!Registration::CheckRegistration())
	{
		DialogBox(GetDllModule(), MAKEINTRESOURCE(IDD_DIALOG3), NULL, Registration::RegistrationProc);
	}

	if (!Registration::IsRegistered())
		return FALSE;

	InitConsole();

	CSplash splash;
	splash.SetBitmap((HBITMAP)LoadImage(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP, NULL, NULL, NULL));
	splash.SetTransparentColor(RGB(255,255,255));
	splash.ShowSplash();

	g_hLowLevelKeyHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandle(NULL), NULL);
	
	Sleep(2000);
	splash.CloseSplash();
	
	CreateDialog(hInstance,MAKEINTRESOURCE(IDD_DIALOG1), NULL, DialogProc);
	ShowWindow(g_hWindow, SW_SHOW);

	// Hauptnachrichtenschleife:
	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return (int) msg.wParam;
}