EgoWindow.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // EgoWindow.cpp : main source file for EgoWindow.exe
  2. //
  3. #include "stdafx.h"
  4. #include "resource.h"
  5. #include <memory>
  6. #include <thread>
  7. #include <mutex>
  8. #include "api.h"
  9. #include "Protocol.pb.h"
  10. #include "VideoRenderer.h"
  11. #include "../common/peer_connection.h"
  12. #include "WindowThread.h"
  13. #include "../common/sensor_socket.h"
  14. #include "ControlSensor.h"
  15. #include "MainDlg.h"
  16. CAppModule _Module;
  17. int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
  18. {
  19. CMessageLoop theLoop;
  20. _Module.AddMessageLoop(&theLoop);
  21. CMainDlg dlgMain;
  22. if(dlgMain.Create(NULL) == NULL)
  23. {
  24. ATLTRACE(_T("Main dialog creation failed!\n"));
  25. return 0;
  26. }
  27. dlgMain.ShowWindow(nCmdShow);
  28. int nRet = theLoop.Run();
  29. _Module.RemoveMessageLoop();
  30. return nRet;
  31. }
  32. int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
  33. {
  34. HRESULT hRes = ::CoInitialize(NULL);
  35. ATLASSERT(SUCCEEDED(hRes));
  36. AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
  37. hRes = _Module.Init(NULL, hInstance);
  38. ATLASSERT(SUCCEEDED(hRes));
  39. int nRet = Run(lpstrCmdLine, nCmdShow);
  40. _Module.Term();
  41. ::CoUninitialize();
  42. return nRet;
  43. }