| 501 | } |
| 502 | |
| 503 | LRESULT CMainFrame::OnSysCommand(UINT nCommand, CPoint) |
| 504 | { |
| 505 | switch (nCommand) |
| 506 | { |
| 507 | case SC_MINIMIZE: |
| 508 | if (!m_hide) |
| 509 | break; |
| 510 | |
| 511 | if (!m_notifyIconData.cbSize) |
| 512 | { |
| 513 | m_notifyIconData.cbSize = sizeof(m_notifyIconData); |
| 514 | m_notifyIconData.hWnd = *this; |
| 515 | m_notifyIconData.uID = 1; |
| 516 | m_notifyIconData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; |
| 517 | m_notifyIconData.uCallbackMessage = WM_SYSTEMTRAYICON; |
| 518 | m_notifyIconData.hIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); |
| 519 | CString sWindowText; |
| 520 | GetWindowText(sWindowText); |
| 521 | _tcscpy_s(m_notifyIconData.szTip, sWindowText); |
| 522 | if (!Shell_NotifyIcon(NIM_ADD, &m_notifyIconData)) |
| 523 | break; |
| 524 | } |
| 525 | ShowWindow(SW_HIDE); |
| 526 | return 0; |
| 527 | } |
| 528 | |
| 529 | SetMsgHandled(false); |
| 530 | return 0; |
| 531 | } |
| 532 | |
| 533 | LRESULT CMainFrame::OnSystemTrayIcon(UINT, WPARAM wParam, LPARAM lParam) |
| 534 | { |
nothing calls this directly
no test coverage detected