2024年2月20日发(作者:)

CPoint mouse;  GetCursorPos(&mouse);  ::SetForegroundWindow(m_);  ::TrackPopupMenu(pSubMenu->m_hMenu, 0, mouse.x, mouse.y, 0,m_, NULL); } else // double click: execute first menu item  ::SendMessage(m_, WM_COMMAND, pSubMenu->GetMenuItemID(0), 0); return 1;}/ MainFrm.h : interface of the CMainFrame class#if !defined(AFX_MAINFRM_H__9ED70A69_C975_4F20_9D4E_B2877E3575D0__INCLUDED_)#define AFX_MAINFRM_H__9ED70A69_C975_4F20_9D4E_B2877E3575D0__INCLUDED_#if _MSC_VER >1000#pragma once#endif // _MSC_VER >1000

#include "trayicon.h"class CMainFrame : public CFrameWnd{ public:  CMainFrame(); protected:  DECLARE_DYNAMIC(CMainFrame)  // Attributes public:  // Overrides  // ClassWizard generated virtual function overrides  //{{AFX_VIRTUAL(CMainFrame)  //}}AFX_VIRTUAL  // Implementation public:  virtual ~CMainFrame();  #ifdef _DEBUG   virtual void AssertValid() const;   virtual void Dump(CDumpContext& dc) const;  #endif protected: // control bar embedded members  CStatusBar m_wndStatusBar;  CTrayIcon m_trayIcon; // my tray icon  CEdit m_wndEdit; // to display tray notifications  int m_iWhichIcon; // which HICON to use  BOOL m_bShutdown; // OK to terminate TRAYTEST  BOOL m_bShowTrayNotifications; // display info in main window  // Generated message map functions protected:  //{{AFX_MSG(CMainFrame)   afx_msg LRESULT OnTrayNotification(WPARAM wp, LPARAM lp);   afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);   afx_msg void OnToggleIcon();   afx_msg void OnViewClear();   afx_msg void OnViewNotifications();   afx_msg void OnUpdateViewClear(CCmdUI* pCmdUI);   afx_msg void OnUpdateViewNotifications(CCmdUI* pCmdUI);   afx_msg void OnClose();   afx_msg void OnAppOpen();   afx_msg void OnAppSuspend();   // NOTE - the ClassWizard will add and remove member functions here.   // DO NOT EDIT what you see in these blocks of generated code!  //}}AFX_MSG DECLARE_MESSAGE_MAP()};///#include "stdafx.h"#include "TrayTest.h"#include "MainFrm.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif

#include "trayicon.h"class CMainFrame : public CFrameWnd{ public:  CMainFrame(); protected:  DECLARE_DYNAMIC(CMainFrame)  // Attributes public:  // Overrides  // ClassWizard generated virtual function overrides  //{{AFX_VIRTUAL(CMainFrame)  //}}AFX_VIRTUAL  // Implementation public:  virtual ~CMainFrame();  #ifdef _DEBUG   virtual void AssertValid() const;   virtual void Dump(CDumpContext& dc) const;  #endif protected: // control bar embedded members  CStatusBar m_wndStatusBar;  CTrayIcon m_trayIcon; // my tray icon  CEdit m_wndEdit; // to display tray notifications  int m_iWhichIcon; // which HICON to use  BOOL m_bShutdown; // OK to terminate TRAYTEST  BOOL m_bShowTrayNotifications; // display info in main window  // Generated message map functions protected:  //{{AFX_MSG(CMainFrame)   afx_msg LRESULT OnTrayNotification(WPARAM wp, LPARAM lp);   afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);   afx_msg void OnToggleIcon();   afx_msg void OnViewClear();   afx_msg void OnViewNotifications();   afx_msg void OnUpdateViewClear(CCmdUI* pCmdUI);   afx_msg void OnUpdateViewNotifications(CCmdUI* pCmdUI);   afx_msg void OnClose();   afx_msg void OnAppOpen();   afx_msg void OnAppSuspend();   // NOTE - the ClassWizard will add and remove member functions here.   // DO NOT EDIT what you see in these blocks of generated code!  //}}AFX_MSG DECLARE_MESSAGE_MAP()};