SProxy.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // dui-demo.cpp : main source file
  2. //
  3. #include "stdafx.h"
  4. #include "MainDlg.h"
  5. #include "LoginDlg.h"
  6. #include "SouiInit.h"
  7. #include "CApp.h"
  8. #include "CTool.h"
  9. int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int /*nCmdShow*/)
  10. {
  11. HRESULT hRes = OleInitialize(NULL);
  12. SASSERT(SUCCEEDED(hRes));
  13. int nRet = 0;
  14. new CApp();
  15. CApp::getSingletonPtr()->Init();
  16. CSouiLoader Loader(hInstance);
  17. InitSystemRes(Loader.GetApp(), Loader.GetComMgr());
  18. InitUserRes(Loader.GetApp(), Loader.GetComMgr());
  19. new CTool();
  20. new SNotifyCenter();
  21. TCHAR szCurrentDir[MAX_PATH] = { 0 };
  22. GetModuleFileName(NULL, szCurrentDir, sizeof(szCurrentDir));
  23. LPTSTR lpInsertPos = _tcsrchr(szCurrentDir, _T('\\'));
  24. _tcscpy(lpInsertPos + 1, _T("\0"));
  25. SetCurrentDirectory(szCurrentDir);
  26. nRet = Run<CLoginDlg>(Loader.GetApp());
  27. if (CApp::getSingletonPtr()->GetOut() == 1)
  28. {
  29. nRet = Run<CMainDlg>(Loader.GetApp());
  30. }
  31. delete CApp::getSingletonPtr();
  32. delete CTool::getSingletonPtr();
  33. delete SNotifyCenter::getSingletonPtr();
  34. OleUninitialize();
  35. return nRet;
  36. }