| VC++自定义消息处理
|
减小字体
增大字体
|
问题:头文件----------------------#define WM_NUMBERKEY WM_USER+1;#define WM_OPERATIONKEY WM_USER+1;*************************************头文件----------------------// Implementationprotected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CCalculatorDlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); //}}AFX_MSG afx_msg void OnNumberKey(UINT nID); afx_msg void OnOperationKey(UINT nID); DECLARE_MESSAGE_MAP()*******************************************.cpp DoDataExchange(CDataExchange* pDX)------------------------------------------------------BEGIN_MESSAGE_MAP(CCalculatorDlg, CDialog) //{{AFX_MSG_MAP(CCalculatorDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP ON_COMMAND_RANGE(IDC_NUMBER1,IDC_NUMBER0,OnNumberKey) ON_COMMAND_RANGE(IDC_MINUS,IDC_RESULT,OnOperationKey)END_MESSAGE_MAP()--------------------Configuration: Calculator - Win32 Debug--------------------Compiling...Skipping... (no relevant changes detected)Calculator.cppLinking...CalculatorDlg.obj : error LNK2001: unresolved external symbol protected: void __thiscall CCalculatorDlg::OnOperationKey(unsigned int) (?OnOperationKey@CCalculatorDlg@@IAEXI@Z)CalculatorDlg.obj : error LNK2001: unresolved external symbol protected: void __thiscall CCalculatorDlg::OnNumberKey(unsigned int) (?OnNumberKey@CCalculatorDlg@@IAEXI@Z)Debug/Calculator.exe : fatal error LNK1120: 2 unresolved externals执行 link.exe 时出错.为什么?
来这里看下,你就知道怎么回事了,呵呵,,,, 祝你成功
VC++中的自定义消息
参考资料:孙鑫 深入详解 如果你对头文件----------------------#define WM_NUMBERKEY WM_USER+1;#define WM_OPERATIONKEY WM_USER+1;*************************************头文件----------------------// Implementationprotected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CCalculatorDlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); //}}AFX_MSG afx_msg void OnNumberKey(UINT nID); afx_msg void OnOperationKey(UINT nID); DECLARE_MESSAGE_MAP()*******************************************.cpp DoDataExchange(CDataExchange* pDX)------------------------------------------------------BEGIN_MESSAGE_MAP(CCalculatorDlg, CDialog) //{{AFX_MSG_MAP(CCalculatorDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP ON_COMMAND_RANGE(IDC_NUMBER1,IDC_NUMBER0,OnNumberKey) ON_COMMAND_RANGE(IDC_MINUS,IDC_RESULT,OnOperationKey)END_MESSAGE_MAP()--------------------Configuration: Calculator - Win32 Debug--------------------Compiling...Skipping... (no relevant changes detected)Calculator.cppLinking...CalculatorDlg.obj : error LNK2001: unresolved external symbol protected: void __thiscall CCalculatorDlg::OnOperationKey(unsigned int) (?OnOperationKey@CCalculatorDlg@@IAEXI@Z)CalculatorDlg.obj : error LNK2001: unresolved external symbol protected: void __thiscall CCalculatorDlg::OnNumberKey(unsigned int) (?OnNumberKey@CCalculatorDlg@@IAEXI@Z)Debug/Calculator.exe : fatal error LNK1120: 2 unresolved externals执行 link.exe 时出错.为什么?这个问题有好的意见或
建议,请留言
|
|
[]
[返回上一页]
[打 印]
|
|
|