SShellNofityHwnd2.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #include "stdafx.h"
  2. #include "SShellNofityHwnd2.h"
  3. namespace SOUI
  4. {
  5. CShellNotifyHwnd2::CShellNotifyHwnd2(SHostWnd * pMainWnd, SShellNotifyIcon* shellnotifyicon) :m_pMainWnd(pMainWnd),m_ShellNotifyIcon(shellnotifyicon)
  6. {
  7. MsgTaskbarCreated = RegisterWindowMessage(L"TaskbarCreated");
  8. Create(L"shell_nofity_msg_windows", 0, 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr);
  9. }
  10. //ÍÐÅÌ֪ͨÏûÏ¢´¦Àíº¯Êý
  11. LRESULT CShellNotifyHwnd2::OnIconNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL)
  12. {
  13. LRESULT bRet = S_FALSE;
  14. switch (lParam)
  15. {
  16. case WM_RBUTTONDOWN:
  17. {
  18. m_ShellNotifyIcon->ShowMenu();
  19. bRet = S_OK;
  20. }break;
  21. case WM_LBUTTONDOWN:
  22. {
  23. if (m_pMainWnd->IsWindowVisible())
  24. m_pMainWnd->ShowWindow(SW_HIDE);
  25. else
  26. {
  27. m_pMainWnd->ShowWindow(SW_SHOW);
  28. SetForegroundWindow(m_pMainWnd->m_hWnd);
  29. }
  30. bRet = S_OK;
  31. }break;
  32. }
  33. return bRet;
  34. }
  35. LRESULT CShellNotifyHwnd2::OnTaskbarCreated(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL)
  36. {
  37. return m_ShellNotifyIcon->Show();
  38. }
  39. void CShellNotifyHwnd2::OnFinalMessage(HWND hWnd)
  40. {
  41. __super::OnFinalMessage(hWnd);
  42. delete this;
  43. }
  44. void CShellNotifyHwnd2::OnTimer(UINT_PTR nIDEvent)
  45. {
  46. switch (nIDEvent)
  47. {
  48. case ANI_TIMER_ID:
  49. {
  50. m_ShellNotifyIcon->NextFrame();
  51. }break;
  52. default:
  53. break;
  54. }
  55. }
  56. }