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.

177 lines
4.7 KiB

  1. // MSQSCANDlg.h : header file
  2. //
  3. #ifndef _MSQSCANDLG_H
  4. #define _MSQSCANDLG_H
  5. #include "Preview.h"
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #define PREVIEW_RES 100
  10. #include "datatypes.h"
  11. #define ID_WIAEVENT_CONNECT 0
  12. #define ID_WIAEVENT_DISCONNECT 1
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CEventCallback
  15. class CEventCallback : public IWiaEventCallback
  16. {
  17. private:
  18. ULONG m_cRef; // Object reference count.
  19. int m_EventID; // What kind of event is this callback for?
  20. public:
  21. IUnknown *m_pIUnkRelease; // release server registration
  22. public:
  23. // Constructor, initialization and destructor methods.
  24. CEventCallback();
  25. ~CEventCallback();
  26. // IUnknown members that delegate to m_pUnkRef.
  27. HRESULT _stdcall QueryInterface(const IID&,void**);
  28. ULONG _stdcall AddRef();
  29. ULONG _stdcall Release();
  30. HRESULT _stdcall Initialize(int EventID);
  31. HRESULT _stdcall ImageEventCallback(
  32. const GUID *pEventGUID,
  33. BSTR bstrEventDescription,
  34. BSTR bstrDeviceID,
  35. BSTR bstrDeviceDescription,
  36. DWORD dwDeviceType,
  37. BSTR bstrFullItemName,
  38. ULONG *plEventType,
  39. ULONG ulReserved);
  40. };
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CMSQSCANDlg dialog
  43. class CMSQSCANDlg : public CDialog
  44. {
  45. // Construction
  46. public:
  47. CMSQSCANDlg(CWnd* pParent = NULL); // standard constructor
  48. //
  49. // events callback
  50. //
  51. CEventCallback* m_pConnectEventCB;
  52. //
  53. // scanner preview window
  54. //
  55. CPreview m_PreviewWindow;
  56. //
  57. // WIA components, WIA device manager, and WIA Wrapper object
  58. //
  59. IWiaDevMgr *m_pIWiaDevMgr;
  60. CWIA m_WIA;
  61. //
  62. // Data transfer, thread information structure
  63. //
  64. DATA_ACQUIRE_INFO m_DataAcquireInfo;
  65. ADF_SETTINGS m_ADFSettings;
  66. //
  67. // UI <--> device settings helpers
  68. //
  69. BOOL InitDialogSettings();
  70. BOOL InitResolutionEditBoxes();
  71. BOOL InitDataTypeComboBox();
  72. BOOL InitContrastSlider();
  73. BOOL InitBrightnessSlider();
  74. BOOL InitFileTypeComboBox();
  75. BOOL ResetWindowExtents();
  76. BOOL ReadADFSettings(ADF_SETTINGS *pADFSettings);
  77. BOOL WriteADFSettings(ADF_SETTINGS *pADFSettings);
  78. BOOL WriteScannerSettingsToDevice(BOOL bPreview = FALSE);
  79. //
  80. // UI helpers
  81. //
  82. INT GetIDAndStringFromGUID(GUID guidFormat, TCHAR *pszguidString);
  83. GUID GetGuidFromID(INT iID);
  84. INT GetIDAndStringFromDataType(LONG lDataType, TCHAR *pszguidString);
  85. LONG GetDataTypeFromID(INT iID);
  86. BOOL SetDeviceNameToWindowTitle(BSTR bstrDeviceName);
  87. //
  88. // Image (clipboard manipulation) helpers
  89. //
  90. BOOL PutDataOnClipboard();
  91. VOID VerticalFlip(BYTE *pBuf);
  92. // Dialog Data
  93. //{{AFX_DATA(CMSQSCANDlg)
  94. enum { IDD = IDD_MSQSCAN_DIALOG };
  95. CButton m_ChangeBothResolutionsCheckBox;
  96. CSpinButtonCtrl m_YResolutionBuddy;
  97. CSpinButtonCtrl m_XResolutionBuddy;
  98. CButton m_ScanButton;
  99. CButton m_PreviewButton;
  100. CComboBox m_FileTypeComboBox;
  101. CComboBox m_DataTypeComboBox;
  102. CSliderCtrl m_ContrastSlider;
  103. CSliderCtrl m_BrightnessSlider;
  104. CStatic m_PreviewRect;
  105. CString m_MAX_Brightness;
  106. CString m_MAX_Contrast;
  107. CString m_MIN_Brightness;
  108. CString m_MIN_Contrast;
  109. long m_XResolution;
  110. long m_YResolution;
  111. CButton m_DataToFile;
  112. CButton m_DataToClipboard;
  113. //}}AFX_DATA
  114. // ClassWizard generated virtual function overrides
  115. //{{AFX_VIRTUAL(CMSQSCANDlg)
  116. protected:
  117. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  118. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  119. //}}AFX_VIRTUAL
  120. // Implementation
  121. protected:
  122. HICON m_hIcon;
  123. // Generated message map functions
  124. //{{AFX_MSG(CMSQSCANDlg)
  125. virtual BOOL OnInitDialog();
  126. afx_msg void OnPaint();
  127. afx_msg HCURSOR OnQueryDragIcon();
  128. afx_msg void OnDeltaposEditXresSpinBuddy(NMHDR* pNMHDR, LRESULT* pResult);
  129. afx_msg void OnDeltaposEditYresSpinBuddy(NMHDR* pNMHDR, LRESULT* pResult);
  130. afx_msg void OnSetfocusEditXres();
  131. afx_msg void OnKillfocusEditXres();
  132. afx_msg void OnKillfocusEditYres();
  133. afx_msg void OnSetfocusEditYres();
  134. afx_msg void OnScanButton();
  135. afx_msg void OnPreviewButton();
  136. afx_msg void OnFileClose();
  137. afx_msg void OnFileSelectDevice();
  138. afx_msg void OnAdfSettings();
  139. //}}AFX_MSG
  140. DECLARE_MESSAGE_MAP()
  141. };
  142. //{{AFX_INSERT_LOCATION}}
  143. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  144. #endif // !defined(AFX_MSQSCANDLG_H__E1A2B3DB_C967_47EF_8487_C4F243D0BC58__INCLUDED_)