Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.5 KiB

  1. // TaskApp.cpp : Defines the entry point for the application.
  2. //
  3. #include "pch.h"
  4. #include "resource.h"
  5. #include "TaskApp.h"
  6. #include "MainWnd.h"
  7. #include "TaskApp_i.c"
  8. CComModule _Module;
  9. BEGIN_OBJECT_MAP(ObjectMap)
  10. END_OBJECT_MAP()
  11. int APIENTRY WinMain(HINSTANCE hInstance,
  12. HINSTANCE /*hPrevInstance*/,
  13. LPSTR /*lpCmdLine*/,
  14. int nCmdShow)
  15. {
  16. int nResult = -1;
  17. CoInitialize(NULL);
  18. _Module.Init(ObjectMap, hInstance);
  19. HMENU hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MAINMENU));
  20. if (hMenu)
  21. {
  22. // Do not scope this at the outer level or it won't be destroyed
  23. // until after CoUninitialize, causing errors.
  24. CMainWnd wnd;
  25. wnd.Create(NULL, CWindow::rcDefault, TEXT("Task UI Test Application"));
  26. if (wnd)
  27. {
  28. // Could pass hMenu as the ID parameter to wnd.Create above, but
  29. // the ID parameter is UINT and the HMENU is therefore truncated
  30. // on 64 bit platforms. (ATL needs to make it a UINT_PTR param)
  31. wnd.SetMenu(hMenu);
  32. wnd.ShowWindow(nCmdShow);
  33. wnd.UpdateWindow();
  34. MSG msg;
  35. while (GetMessage(&msg, NULL, 0, 0) > 0)
  36. {
  37. TranslateMessage(&msg);
  38. DispatchMessage(&msg);
  39. }
  40. nResult = (int)msg.wParam;
  41. }
  42. DestroyMenu(hMenu);
  43. }
  44. _Module.Term();
  45. CoUninitialize();
  46. return nResult;
  47. }