Example #1
0
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   PSTR      pCmdLine,
                   int       nShowCmd)
{
  HRESULT result = CoInitialize(0);
  LPDIRECTINPUT directinput;

  if (FAILED(result))
    {
      std::cerr << "CL_DisplayWindow_Win32: Damn murphy must hate you. CoInitialize failed!" << std::endl;
    }

  result = CoCreateInstance(CLSID_DirectInput, 0, CLSCTX_INPROC_SERVER, IID_IDirectInput, (LPVOID *) &directinput);
  if (FAILED(result))
    {
      std::cerr << "FAILURE" << std::endl;
    }
  else
    {
      std::cerr << "SUCCESS" << std::endl;
      result = directinput->Initialize(GetModuleHandle(0), DIRECTINPUT_VERSION);
    }

  if (!InitWindowsApp(hInstance, nShowCmd))
    {
      ::MessageBox(0, "Init - Failed", "Error", MB_OK);
      return 0;
    }

  return Run();
}
Example #2
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int nShowCmd)
{
	if(!InitWindowsApp(hInstance, nShowCmd))
		return 0;

	// Loop until WM_QUIT message is received
	return Run();
}
Example #3
0
BasicWindow::BasicWindow(HINSTANCE appHandle, int showStyle)
	: mCaption("")
{
	ReadIniFile();

	// If window creation failed, show a message.
	if(!InitWindowsApp(appHandle, showStyle))
		ShowMessage("Window was not created!");
}
Example #4
0
// Windows equivalant to main()
int WINAPI 
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int nShowCmd)
{
	// First call our wrapper function (InitWindowsApp) to create and initialize the
	// main application window, passing in the hInstance and nShowCmd values as
	// arguments.
	if(!InitWindowsApp(hInstance, nShowCmd)) 
		return 0;


	// Once our application has been created and initialized we enter the message loop.  We
	// stay in the message loop until a WM_QUIT mesage is received, indicating the application
	// should be terminated.
	return Run(); 
}
Example #5
0
// Windows equivalant to main()
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
{
	/*
	Some dual core systems have a problem where the different CPUs return different
	QueryPerformanceCounter values. So when this thread is schedule on the other CPU
	in a later frame, we could even get a negative frameTime. To solve this we force
	the main thread to always run on CPU 0.
	*/
	SetThreadAffinityMask(GetCurrentThread(), 1);

	if (!InitWindowsApp(hInstance, showCmd))
		return 0;

	return Run();
}