消息应答函数的前缀
// ProCAppDlg.h : 头文件 // add by jzh 2009-07-05 #pragma once #include "afxwin.h" #define WM_NOTIFYICON WM_USER+5 // 条码信息结构体 struct BarcodeInfo { CString Name; CString Spec; CString Other; CString Barcode; }; // 打印任务 UINT PrintWork(LPVOID lpParam); // CProCAppDlg 对话框 class CProCAppDlg : public CDialog { // 构造 public: CProCAppDlg(CWnd* pParent = NULL); // 标准构造函数 // 对话框数据 enum { IDD = IDD_PROCAPP_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 // 实现 protected: HICON m_hIcon; virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() afx_msg void OnSysCommand(UINT nID, LPARAM lParam); long OnNotifyIcon(WPARAM wParam, LPARAM lParam); afx_msg void OnClose(); afx_msg void OnDestroy(); afx_msg void OnShow(); afx_msg void OnHide(); afx_msg void OnExit(); public: afx_msg void OnBnClickedOk(); afx_msg void OnBnClickedCancel(); void ToTray(bool bFlag); CEdit m_Name; CEdit m_Spec; CEdit m_Other; CEdit m_Barcode; };
// ProCAppDlg.cpp : 实现文件 // add by jzh 2009-07-05 #include "stdafx.h" #include "ProCApp.h" #include "ProCAppDlg.h" #include "CommFunc.h" // 公用函数类 #include "DbHelper.h" // 数据库辅助函数类 #ifdef _DEBUG #define new DEBUG_NEW #endif NOTIFYICONDATA m_nid; // 用来传递托盘区域消息的信息 BarcodeInfo BarInfo; // 用来传递条码信息结构体 // CProCAppDlg 对话框 CProCAppDlg::CProCAppDlg(CWnd* pParent /*=NULL*/) : CDialog(CProCAppDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } // 控件和数据成员间建立一种映射关系 void CProCAppDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_EDIT_NAME, m_Name); DDX_Control(pDX, IDC_EDIT_SPEC, m_Spec); DDX_Control(pDX, IDC_EDIT_OTHER, m_Other); DDX_Control(pDX, IDC_EDIT_BARCODE, m_Barcode); } // 用户消息映射定义 BEGIN_MESSAGE_MAP(CProCAppDlg, CDialog) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_WM_CLOSE() ON_WM_DESTROY() ON_BN_CLICKED(IDOK, &CProCAppDlg::OnBnClickedOk) ON_BN_CLICKED(IDCANCEL, &CProCAppDlg::OnBnClickedCancel) ON_MESSAGE(WM_NOTIFYICON, OnNotifyIcon) ON_COMMAND(ID_SHOW, OnShow) ON_COMMAND(ID_HIDE, OnHide) ON_COMMAND(ID_EXIT, OnExit) END_MESSAGE_MAP()