|
#1
| |||
| |||
| [MFC]system tray問題 請問增加了一個logo在右下角後,應該如何編寫代碼才能对它操作呢 即是我righ click ,left click右下角的logo它就出現相關的反應,請問應該如何寫呢 我的程式如下: findingDlg.cpp #define WM_MY_TRAY_NOTIFICATION WM_USER+0 BEGIN_MESSAGE_MAP(CFindingDlg, CDialog) //{{AFX_MSG_MAP(CFindingDlg) ON_WM_SYSCOMMAND() ON_MESSAGE(WM_MY_TRAY_NOTIFICATION, OnTrayNotification) //己增加這信息 ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_EN_CHANGE(IDC_find, OnChangefind) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) ON_WM_CANCELMODE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ============================================================= findingDlg.h protected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CFindingDlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg LRESULT OnTrayNotification(UINT message,WPARAM wp, LPARAM lp);//己增加這信息 afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnButton1(); afx_msg void OnButton2(); afx_msg void OnChangefind(); afx_msg void OnButton3(); afx_msg void OnCancelMode(); //}}AFX_MSG DECLARE_MESSAGE_MAP() ================================================================== findingDlg.cpp 這裡就是當右下角的logo收到message,就作相關的操作 但不知道什么問題不能成功 #define MYWM_NOTIFYICON WM_USER+1 LRESULT CFindingDlg::OnTrayNotification(UINT message,WPARAM wID, LPARAM lEvent) { switch(message) case MYWM_NOTIFYICON: MessageBox("aa","fuck",IDOK); return 1; } |