コード例 #1
0
ファイル: MainDlg.cpp プロジェクト: 340211173/hf-2011
LRESULT CMainDlg::OnTrayNotification(WPARAM wParam, LPARAM lParam)
{
	if(wParam == IDR_MAINFRAME && 
		(lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN))
		SetTrayIcon();

	if(wParam == IDR_MAINFRAME 
		&& lParam == WM_RBUTTONUP
		&& theApp.m_dwSubWindowCount > 0)
		lParam = WM_LBUTTONDOWN;

	if(wParam == IDR_MAINFRAME && lParam == WM_LBUTTONDOWN)
	{
		if(m_MessageIndex != 0)
		{
			int tmpIndex = m_MessageIndex;
			m_MessageIndex = 0;
			AfxMessageBox(m_OnLine.GetInternet()->m_sMessage[tmpIndex], MB_ICONINFORMATION);
			m_OnLine.GetInternet()->m_sMessage[tmpIndex][0] = 0;
			SetTrayIcon();
			return 0;
		}

		lParam = WM_LBUTTONDBLCLK;
	}

    return m_TrayIcon.OnTrayNotification(wParam, lParam);
}
コード例 #2
0
ファイル: RedShell.cpp プロジェクト: reklis/redshell
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;
	TCHAR szHello[MAX_LOADSTRING];
	LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);

	switch (message)
	{
        case WM_ICON_NOTIFY:
            return TrayIcon.OnTrayNotification(wParam, lParam);

		case WM_COMMAND:
			wmId    = LOWORD(wParam);
			wmEvent = HIWORD(wParam);
			// Parse the menu selections:
			switch (wmId)
			{
				case IDM_ABOUT:
				   DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
				   break;
				case IDM_EXIT:
				   DestroyWindow(hWnd);
				   break;
				default:
				   return DefWindowProc(hWnd, message, wParam, lParam);
			}
			break;
		case WM_PAINT:
			hdc = BeginPaint(hWnd, &ps);
			// TODO: Add any drawing code here...
			RECT rt;
			GetClientRect(hWnd, &rt);
			DrawText(hdc, szHello, strlen(szHello), &rt, DT_VCENTER | DT_CENTER | DT_SINGLELINE |DT_WORDBREAK);
			EndPaint(hWnd, &ps);
			break;

		case WM_DESTROY:
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}
コード例 #3
0
ファイル: MainFrame.cpp プロジェクト: Castlely/FILTER
LRESULT CMainFrame::OnTrayNotification(WPARAM wParam, LPARAM lParam)
{
	if(wParam == IDR_MAINFRAME && lParam == WM_LBUTTONDOWN)
	{
		if(m_MessageIndex != 0)
		{
			int tmpIndex = m_MessageIndex;
			m_MessageIndex = 0;
			AfxMessageBox(theApp.m_sMessage[tmpIndex], MB_ICONINFORMATION);
			return 0;
		}

		lParam = WM_LBUTTONDBLCLK;
	}

    return m_TrayIcon.OnTrayNotification(wParam, lParam);
}
コード例 #4
0
// This is the global (static) callback function for all TrayIcon windows
LRESULT PASCAL CSystemTray::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    // The option here is to maintain a list of all TrayIcon windows,
    // and iterate through them. If you do this, remove these 3 lines.
    CSystemTray* pTrayIcon = m_pThis;
    if (pTrayIcon->GetSafeHwnd() != hWnd)
        return ::DefWindowProc(hWnd, message, wParam, lParam);

    // If maintaining a list of TrayIcon windows, then the following...
    // pTrayIcon = GetFirstTrayIcon()
    // while (pTrayIcon != NULL)
    // {
    //    if (pTrayIcon->GetSafeHwnd() != hWnd) continue;

          // Taskbar has been recreated - all TrayIcons must process this.
          if (message == CSystemTray::m_nTaskbarCreatedMsg)
              return pTrayIcon->OnTaskbarCreated(wParam, lParam);

          // Animation timer
          if (message == WM_TIMER && wParam == pTrayIcon->GetTimerID())
              return pTrayIcon->OnTimer(wParam);

          // Settings changed
          if (message == WM_SETTINGCHANGE && wParam == pTrayIcon->GetTimerID())
              return pTrayIcon->OnSettingChange(wParam, (LPCTSTR) lParam);

          // Is the message from the icon for this TrayIcon?
          if (message == pTrayIcon->GetCallbackMessage())
              return pTrayIcon->OnTrayNotification(wParam, lParam);

    //    pTrayIcon = GetNextTrayIcon();
    // }

    // Message has not been processed, so default.
    return ::DefWindowProc(hWnd, message, wParam, lParam);
}