/src/compiler/ucos-vs2008/ftklua_run/ftklua_run.cpp

http://ftk.googlecode.com/ · C++ · 192 lines · 121 code · 27 blank · 44 comment · 11 complexity · a7e802161bca89131a6fed8fefe92216 MD5 · raw file

  1. // ftklua_run.cpp : ???????????
  2. //
  3. #include "stdafx.h"
  4. #include "ftklua_run.h"
  5. #if 0
  6. #define MAX_LOADSTRING 100
  7. // ????:
  8. HINSTANCE hInst; // ????
  9. TCHAR szTitle[MAX_LOADSTRING]; // ?????
  10. TCHAR szWindowClass[MAX_LOADSTRING]; // ?????
  11. // ????????????????:
  12. ATOM MyRegisterClass(HINSTANCE hInstance);
  13. BOOL InitInstance(HINSTANCE, int);
  14. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  15. INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
  16. int APIENTRY _tWinMain(HINSTANCE hInstance,
  17. HINSTANCE hPrevInstance,
  18. LPTSTR lpCmdLine,
  19. int nCmdShow)
  20. {
  21. UNREFERENCED_PARAMETER(hPrevInstance);
  22. UNREFERENCED_PARAMETER(lpCmdLine);
  23. // TODO: ???????
  24. MSG msg;
  25. HACCEL hAccelTable;
  26. // ????????
  27. LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
  28. LoadString(hInstance, IDC_FTKLUA_RUN, szWindowClass, MAX_LOADSTRING);
  29. MyRegisterClass(hInstance);
  30. // ?????????:
  31. if (!InitInstance (hInstance, nCmdShow))
  32. {
  33. return FALSE;
  34. }
  35. hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_FTKLUA_RUN));
  36. // ?????:
  37. while (GetMessage(&msg, NULL, 0, 0))
  38. {
  39. if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  40. {
  41. TranslateMessage(&msg);
  42. DispatchMessage(&msg);
  43. }
  44. }
  45. return (int) msg.wParam;
  46. }
  47. //
  48. // ??: MyRegisterClass()
  49. //
  50. // ??: ??????
  51. //
  52. // ??:
  53. //
  54. // ????
  55. // ??????? Windows 95 ??“RegisterClassEx”
  56. // ????? Win32 ???????????????????????????
  57. // ??????????????
  58. // “?????”????
  59. //
  60. ATOM MyRegisterClass(HINSTANCE hInstance)
  61. {
  62. WNDCLASSEX wcex;
  63. wcex.cbSize = sizeof(WNDCLASSEX);
  64. wcex.style = CS_HREDRAW | CS_VREDRAW;
  65. wcex.lpfnWndProc = WndProc;
  66. wcex.cbClsExtra = 0;
  67. wcex.cbWndExtra = 0;
  68. wcex.hInstance = hInstance;
  69. wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_FTKLUA_RUN));
  70. wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
  71. wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
  72. wcex.lpszMenuName = MAKEINTRESOURCE(IDC_FTKLUA_RUN);
  73. wcex.lpszClassName = szWindowClass;
  74. wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
  75. return RegisterClassEx(&wcex);
  76. }
  77. //
  78. // ??: InitInstance(HINSTANCE, int)
  79. //
  80. // ??: ????????????
  81. //
  82. // ??:
  83. //
  84. // ?????????????????????
  85. // ???????????
  86. //
  87. BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
  88. {
  89. HWND hWnd;
  90. hInst = hInstance; // ?????????????
  91. hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
  92. CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
  93. if (!hWnd)
  94. {
  95. return FALSE;
  96. }
  97. ShowWindow(hWnd, nCmdShow);
  98. UpdateWindow(hWnd);
  99. return TRUE;
  100. }
  101. //
  102. // ??: WndProc(HWND, UINT, WPARAM, LPARAM)
  103. //
  104. // ??: ?????????
  105. //
  106. // WM_COMMAND - ????????
  107. // WM_PAINT - ?????
  108. // WM_DESTROY - ?????????
  109. //
  110. //
  111. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  112. {
  113. int wmId, wmEvent;
  114. PAINTSTRUCT ps;
  115. HDC hdc;
  116. switch (message)
  117. {
  118. case WM_COMMAND:
  119. wmId = LOWORD(wParam);
  120. wmEvent = HIWORD(wParam);
  121. // ??????:
  122. switch (wmId)
  123. {
  124. case IDM_ABOUT:
  125. DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
  126. break;
  127. case IDM_EXIT:
  128. DestroyWindow(hWnd);
  129. break;
  130. default:
  131. return DefWindowProc(hWnd, message, wParam, lParam);
  132. }
  133. break;
  134. case WM_PAINT:
  135. hdc = BeginPaint(hWnd, &ps);
  136. // TODO: ??????????...
  137. EndPaint(hWnd, &ps);
  138. break;
  139. case WM_DESTROY:
  140. PostQuitMessage(0);
  141. break;
  142. default:
  143. return DefWindowProc(hWnd, message, wParam, lParam);
  144. }
  145. return 0;
  146. }
  147. // “??”?????????
  148. INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  149. {
  150. UNREFERENCED_PARAMETER(lParam);
  151. switch (message)
  152. {
  153. case WM_INITDIALOG:
  154. return (INT_PTR)TRUE;
  155. case WM_COMMAND:
  156. if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
  157. {
  158. EndDialog(hDlg, LOWORD(wParam));
  159. return (INT_PTR)TRUE;
  160. }
  161. break;
  162. }
  163. return (INT_PTR)FALSE;
  164. }
  165. #endif