code_twain/sln/usb_tools/usb_toolsDlg.h

76 lines
1.8 KiB
C++

// usb_toolsDlg.h: 头文件
//
#pragma once
#include <vector>
#include <thread>
#include <memory>
#include "DlgScanner.h"
// CusbtoolsDlg 对话框
class CusbtoolsDlg : public CDialogEx
{
typedef struct _scanner
{
DWORD id;
ONLNSCANNER usb;
CDlgScanner* dlg;
}SCANNER;
std::vector<SCANNER> pnp_que_;
HMENU tray_;
HWND desktop_;
DWORD id_ = 1;
void enable_io_ui(bool enable);
void add_pnp_que(ONLNSCANNER* pnp);
void remove_pnp_que(ONLNSCANNER* pnp = NULL);
void append_log(const wchar_t* log, UINT id);
void log_pnp(ONLNSCANNER* pnp, bool arrive);
bool endpoint_from_combo_text(wchar_t* text, BYTE& type, BYTE& addr);
void close_device(SCANNER& pnp);
ONLNSCANNER* get_cur_device(void);
void open_usb(SCANNER& pnp, bool from_list = true);
// 构造
public:
CusbtoolsDlg(CWnd* pParent = nullptr); // 标准构造函数
~CusbtoolsDlg();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_USB_TOOLS_DIALOG };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
std::string log_file_;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
afx_msg LRESULT OnUsbPnp(WPARAM wp, LPARAM lp);
afx_msg LRESULT OnRcvMsg(WPARAM wp, LPARAM lp);
afx_msg LRESULT OnDevDlgClosed(WPARAM wp, LPARAM lp);
afx_msg LRESULT OnTray(WPARAM wp, LPARAM lp);
afx_msg void OnBnClickedCheckAutoMon();
CListCtrl devl_;
afx_msg void OnNMDblclkListDevices(NMHDR* pNMHDR, LRESULT* pResult);
CComboBox ep2_;
afx_msg void OnBnClickedButtonClear();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnTrayExit();
afx_msg void OnTrayDevice(UINT id);
afx_msg void OnBnClickedOk();
afx_msg void OnSize(UINT nType, int cx, int cy);
};