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.

132 lines
3.8 KiB

  1. #include <windows.h> // required for all Windows applications
  2. #include "dpspimp.h"
  3. #include "logit.h"
  4. #include "tapicode.h"
  5. HINSTANCE hInst = NULL;
  6. char szAppName[] = "DPlay Serial Monitor"; // The name of this application
  7. DWORD WndProcStart(LPVOID lpv)
  8. {
  9. ((CImpIDP_SP *)pSrv->pThis)->WndProc();
  10. return(0);
  11. }
  12. DWORD CImpIDP_SP::WndProc()
  13. {
  14. MSG msg;
  15. HANDLE hAccelTable;
  16. HINSTANCE hInstance = (HINSTANCE) GetModuleHandle(NULL);
  17. WNDCLASS wc;
  18. HWND hWnd; // Main window handle.
  19. if (! InitializeTAPI(NULL))
  20. return(0);
  21. TSHELL_INFO("WndProc starting");
  22. wc.style = 0;// Class style(s).
  23. wc.lpfnWndProc = (WNDPROC)WndProc; // Window Procedure
  24. wc.cbClsExtra = 0; // No per-class extra data.
  25. wc.cbWndExtra = 0; // No per-window extra data.
  26. wc.hInstance = hInst; // Owner of this class
  27. wc.hIcon = NULL;
  28. wc.hCursor = NULL;
  29. wc.hbrBackground = NULL;
  30. wc.lpszMenuName = NULL;
  31. wc.lpszClassName = szAppName; // Name to register as
  32. RegisterClass(&wc);
  33. hInst = hInstance;
  34. hWnd = CreateWindow(
  35. szAppName, // See RegisterClass() call.
  36. NULL, // Text for window title bar.
  37. WS_POPUP,
  38. 0,
  39. 0,
  40. 0,
  41. 0,
  42. NULL, // Overlapped windows have no parent.
  43. NULL, // Use the window class menu.
  44. hInstance, // This instance owns this window.
  45. NULL // We don't use any data in our WM_CREATE
  46. );
  47. // If window could not be created, return "failure"
  48. if (!hWnd)
  49. {
  50. return (FALSE);
  51. }
  52. TSHELL_INFO("hWnd Created");
  53. ShowWindow(hWnd, SW_HIDE); // Show the window
  54. /* Acquire and dispatch messages until a WM_QUIT message is received. */
  55. while (GetMessage(&msg, // message structure
  56. NULL, // handle of window receiving the message
  57. 0, // lowest message to examine
  58. 0) // highest message to examine
  59. && !m_bStopHwnd
  60. {
  61. TranslateMessage(&msg); // Translates virtual key codes
  62. DispatchMessage(&msg); // Dispatches message to window
  63. }
  64. ShutDownTAPI();
  65. return (0); // Returns the value from PostQuitMessage
  66. }
  67. /****************************************************************************
  68. FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
  69. PURPOSE: Processes messages
  70. MESSAGES:
  71. WM_COMMAND - application menu (About dialog box)
  72. WM_DESTROY - destroy window
  73. COMMENTS:
  74. To process the IDM_ABOUT message, call MakeProcInstance() to get the
  75. current instance address of the About() function. Then call Dialog
  76. box which will create the box according to the information in your
  77. generic.rc file and turn control over to the About() function. When
  78. it returns, free the intance address.
  79. ****************************************************************************/
  80. LRESULT CALLBACK WndProc(
  81. HWND hWnd, // window handle
  82. UINT message, // type of message
  83. WPARAM uParam, // additional information
  84. LPARAM lParam) // additional information
  85. {
  86. FARPROC lpProcAbout; // pointer to the "About" function
  87. int wmId, wmEvent;
  88. switch (message)
  89. {
  90. case WM_DESTROY: // message: window being destroyed
  91. PostQuitMessage(0);
  92. break;
  93. default: // Passes it on if unproccessed
  94. return (DefWindowProc(hWnd, message, uParam, lParam));
  95. }
  96. return (0);
  97. }
  98.