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.

152 lines
5.1 KiB

  1. #include "stdafx.h"
  2. #include "resource.h"
  3. #include "wiapeek.h"
  4. #include "msgwrap.h"
  5. CMessageWrapper g_MsgWrapper;
  6. //////////////////////////////////////////////////////////////////////////
  7. //
  8. // Function: WinMain()
  9. // Details: This function is WinMain... enough said. ;) It creates a Modal
  10. // dialog as the main application window.
  11. //
  12. // hInstance - instance of this application
  13. // hPrevInstance - Previous instance of this applcation (already running)
  14. // lpCmdLine - command line arguments
  15. // nCmdShow - show state, specifies how the window should be shown
  16. //
  17. //////////////////////////////////////////////////////////////////////////
  18. INT APIENTRY WinMain(HINSTANCE hInstance,
  19. HINSTANCE hPrevInstance,
  20. LPSTR lpCmdLine,
  21. int nCmdShow)
  22. {
  23. CoInitialize(NULL);
  24. g_MsgWrapper.Initialize(hInstance);
  25. DialogBox(hInstance, (LPCTSTR)IDD_MAIN_DIALOG, NULL, (DLGPROC)MainDlg);
  26. CoUninitialize();
  27. return 0;
  28. }
  29. //////////////////////////////////////////////////////////////////////////
  30. //
  31. // Function: MainDlg()
  32. // Details: This function is the Window Proc for this dialog. It
  33. // dispatches messages to their correct handlers. If there is
  34. // handler, we let Windows handle the message for us.
  35. //
  36. // hDlg - handle to the dialog's window
  37. // message - windows message (incoming from system)
  38. // wParam - WPARAM parameter (used for windows data/argument passing)
  39. // lParam - LPARAM parameter (used for windows data/argument passing)
  40. //
  41. //////////////////////////////////////////////////////////////////////////
  42. LRESULT CALLBACK MainDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  43. {
  44. INT wmId = 0;
  45. INT wmEvent = 0;
  46. TCHAR szApplicationFilePath[1024];
  47. HWND hApplicationPathEditBox = NULL;
  48. switch (message)
  49. {
  50. //
  51. // We want first crack at processing any messages
  52. //
  53. case WM_INITDIALOG:
  54. return g_MsgWrapper.OnInitDialog(hDlg);
  55. break;
  56. case WM_COMMAND:
  57. wmId = LOWORD(wParam);
  58. wmEvent = HIWORD(wParam);
  59. switch(wmId)
  60. {
  61. //
  62. // Trap Button IDs, and Menu IDs
  63. //
  64. case IDC_WIA_DEVICE_LIST:
  65. if(wmEvent == LBN_SELCHANGE){
  66. /*
  67. if(!g_MsgWrapper.OnRefreshEventListBox(hDlg)){
  68. g_MsgWrapper.EnableAllControls(hDlg, FALSE);
  69. } else {
  70. g_MsgWrapper.EnableAllControls(hDlg, TRUE);
  71. }
  72. */
  73. }
  74. break;
  75. case IDCANCEL: // CANCEL (Button)
  76. case IDM_EXIT: // FILE | EXIT (Menu)
  77. return g_MsgWrapper.OnExit(hDlg,wParam);
  78. break;
  79. case IDM_ABOUT: // HELP | ABOUT (Menu)
  80. g_MsgWrapper.OnAbout(hDlg);
  81. break;
  82. default:
  83. break;
  84. }
  85. break;
  86. default:
  87. //
  88. // Let windows take care of it (DefWindowProc(hDlg,message,wParam,lParam))
  89. //
  90. break;
  91. }
  92. return FALSE;
  93. }
  94. #ifdef _OVERRIDE_LIST_BOXES
  95. //////////////////////////////////////////////////////////////////////////
  96. //
  97. // Function: DeviceListBox()
  98. // Details: This function is the Window Proc for the Device ListBox. It
  99. // dispatches messages to their correct handlers. If there is
  100. // handler, we let Windows handle the message for us.
  101. //
  102. // hDlg - handle to the dialog's window
  103. // message - windows message (incoming from system)
  104. // wParam - WPARAM parameter (used for windows data/argument passing)
  105. // lParam - LPARAM parameter (used for windows data/argument passing)
  106. //
  107. //////////////////////////////////////////////////////////////////////////
  108. LRESULT CALLBACK DeviceListBox(HWND hListBox, UINT message, WPARAM wParam, LPARAM lParam)
  109. {
  110. INT wmId = 0;
  111. INT wmEvent = 0;
  112. return DefDeviceListBox(hListBox,message,wParam,lParam);
  113. }
  114. //////////////////////////////////////////////////////////////////////////
  115. //
  116. // Function: EventListBox()
  117. // Details: This function is the Window Proc for the Event ListBox. It
  118. // dispatches messages to their correct handlers. If there is
  119. // handler, we let Windows handle the message for us.
  120. //
  121. // hDlg - handle to the dialog's window
  122. // message - windows message (incoming from system)
  123. // wParam - WPARAM parameter (used for windows data/argument passing)
  124. // lParam - LPARAM parameter (used for windows data/argument passing)
  125. //
  126. //////////////////////////////////////////////////////////////////////////
  127. LRESULT CALLBACK EventListBox(HWND hListBox, UINT message, WPARAM wParam, LPARAM lParam)
  128. {
  129. INT wmId = 0;
  130. INT wmEvent = 0;
  131. return DefEventListBox(hListBox,message,wParam,lParam);
  132. }
  133. #endif