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.

101 lines
2.5 KiB

  1. // MSQSCAN.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "MSQSCAN.h"
  5. #include "MSQSCANDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CMSQSCANApp
  13. BEGIN_MESSAGE_MAP(CMSQSCANApp, CWinApp)
  14. //{{AFX_MSG_MAP(CMSQSCANApp)
  15. // NOTE - the ClassWizard will add and remove mapping macros here.
  16. // DO NOT EDIT what you see in these blocks of generated code!
  17. //}}AFX_MSG
  18. ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  19. END_MESSAGE_MAP()
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CMSQSCANApp construction
  22. CMSQSCANApp::CMSQSCANApp()
  23. {
  24. // TODO: add construction code here,
  25. // Place all significant initialization in InitInstance
  26. }
  27. /////////////////////////////////////////////////////////////////////////////
  28. // The one and only CMSQSCANApp object
  29. CMSQSCANApp theApp;
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CMSQSCANApp initialization
  32. BOOL CMSQSCANApp::InitInstance()
  33. {
  34. AfxEnableControlContainer();
  35. //
  36. // Initialize COM
  37. //
  38. if (SUCCEEDED(CoInitialize(NULL))) {
  39. // Standard initialization
  40. // If you are not using these features and wish to reduce the size
  41. // of your final executable, you should remove from the following
  42. // the specific initialization routines you do not need.
  43. #ifdef _AFXDLL
  44. Enable3dControls(); // Call this when using MFC in a shared DLL
  45. #else
  46. Enable3dControlsStatic(); // Call this when linking to MFC statically
  47. #endif
  48. CMSQSCANDlg dlg;
  49. m_pMainWnd = &dlg;
  50. switch (dlg.DoModal()) {
  51. case IDOK:
  52. break;
  53. case IDCANCEL:
  54. break;
  55. default:
  56. break;
  57. }
  58. //
  59. // clean up WIA before we uninitialize COM
  60. //
  61. dlg.m_WIA.CleanUp();
  62. if(dlg.m_DataAcquireInfo.hBitmapData != NULL) {
  63. GlobalUnlock(dlg.m_DataAcquireInfo.hBitmapData);
  64. GlobalFree(dlg.m_DataAcquireInfo.hBitmapData);
  65. dlg.m_DataAcquireInfo.hBitmapData = NULL;
  66. }
  67. //
  68. // Uninitialize COM
  69. //
  70. CoUninitialize();
  71. } else {
  72. AfxMessageBox("COM Failed to initialize correctly");
  73. }
  74. // Since the dialog has been closed, return FALSE so that we exit the
  75. // application, rather than start the application's message pump.
  76. return FALSE;
  77. }