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.

98 lines
2.1 KiB

  1. #include "stdafx.h"
  2. #include "MainWnd.h"
  3. #include "resource.h"
  4. BOOL CALLBACK MyEnumChildProc( HWND hwnd, LPARAM lParam);
  5. LRESULT CMainWnd::OnCommand( WPARAM wParam, LPARAM lParam )
  6. {
  7. SC_BEGIN_COMMAND_HANDLERS()
  8. {
  9. SC_HANDLE_COMMAND(IDM_EXIT,OnFileExit);
  10. SC_HANDLE_COMMAND(IDM_SELECT_DEVICE,OnSelectDevice);
  11. }
  12. SC_END_COMMAND_HANDLERS();
  13. }
  14. LRESULT CMainWnd::OnPaint( WPARAM wParam, LPARAM lParam )
  15. {
  16. PAINTSTRUCT ps;
  17. HDC hDC = BeginPaint( m_hWnd, &ps );
  18. if (hDC) {
  19. EndPaint( m_hWnd, &ps );
  20. }
  21. return(0);
  22. }
  23. LRESULT CMainWnd::OnDestroy( WPARAM wParam, LPARAM lParam )
  24. {
  25. PostQuitMessage(0);
  26. return(0);
  27. }
  28. LRESULT CMainWnd::OnCreate( WPARAM wParam, LPARAM lParam )
  29. {
  30. return(0);
  31. }
  32. VOID CMainWnd::OnFileExit( WPARAM wParam, LPARAM lParam )
  33. {
  34. PostQuitMessage(0);
  35. }
  36. VOID CMainWnd::OnSelectDevice( WPARAM wParam, LPARAM lParam )
  37. {
  38. MessageBox(NULL,TEXT("This is for the Select Device Dialog"),TEXT("Place Holder Dialog"),MB_OK);
  39. return;
  40. }
  41. LPARAM CMainWnd::OnSize( WPARAM wParam, LPARAM lParam )
  42. {
  43. INT nWidth = LOWORD(lParam); // width of client area
  44. INT nHeight = HIWORD(lParam); // height of client area
  45. //Trace(TEXT("Client Width = %d, Client Height = %d"),nWidth,nHeight);
  46. MSG msg;
  47. msg.message = WM_PARENT_WM_SIZE;
  48. msg.lParam = lParam;
  49. msg.wParam = 0;
  50. PostMessageToAllChildren(msg);
  51. switch(wParam) {
  52. case SIZE_MAXHIDE:
  53. break;
  54. case SIZE_MAXIMIZED:
  55. break;
  56. case SIZE_MAXSHOW:
  57. break;
  58. case SIZE_MINIMIZED:
  59. break;
  60. case SIZE_RESTORED:
  61. break;
  62. default:
  63. break;
  64. }
  65. return(0);
  66. }
  67. LPARAM CMainWnd::OnSetFocus( WPARAM wParam, LPARAM lParam )
  68. {
  69. InvalidateRect( m_hWnd, NULL, FALSE );
  70. return(0);
  71. }
  72. VOID CMainWnd::PostMessageToAllChildren(MSG msg)
  73. {
  74. EnumChildWindows(m_hWnd,(WNDENUMPROC)MyEnumChildProc,(LPARAM)&msg);
  75. }
  76. BOOL CALLBACK MyEnumChildProc( HWND hwnd, LPARAM lParam)
  77. {
  78. if(hwnd == NULL)
  79. return FALSE;
  80. MSG *pMsg = (MSG*)lParam;
  81. PostMessage(hwnd, pMsg->message,pMsg->wParam,pMsg->lParam);
  82. return TRUE;
  83. }