亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? systemtray.cpp

?? 通信增值服務(wù),上網(wǎng)接聽電話
?? CPP
字號(hào):
/////////////////////////////////////////////////////////////////////////////
// SystemTray.cpp : implementation file
//
// This is a conglomeration of ideas from the MSJ "Webster" application,
// sniffing round the online docs, and from other implementations such
// as PJ Naughter's "CTrayNotifyIcon" (http://indigo.ie/~pjn/ntray.html)
// especially the "CSystemTray::OnTrayNotification" member function.
// Joerg Koenig suggested the icon animation stuff
//
// This class is a light wrapper around the windows system tray stuff. It
// adds an icon to the system tray with the specified ToolTip text and 
// callback notification value, which is sent back to the Parent window.
//
// The tray icon can be instantiated using either the constructor or by
// declaring the object and creating (and displaying) it later on in the
// program. eg.
//
//        CSystemTray m_SystemTray;    // Member variable of some class
//        
//        ... 
//        // in some member function maybe...
//        m_SystemTray.Create(pParentWnd, WM_MY_NOTIFY, "Click here", 
//                          hIcon, nSystemTrayID);
//
// Written by Chris Maunder (chrismaunder@codeguru.com)
// Copyright (c) 1998.
//
// Updated: 25 Jul 1998 - Added icon animation, and derived class
//                        from CWnd in order to handle messages. (CJM)
//                        (icon animation suggested by Joerg Koenig.
//                        Added API to set default menu item. Code provided
//                        by Enrico Lelina.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is 
// not sold for profit without the authors written consent, and 
// providing that this notice and the authors name is included. If 
// the source code in  this file is used in any commercial application 
// then acknowledgement must be made to the author of this file 
// (in whatever form you wish).
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability if it causes any damage to your
// computer, causes your pet cat to fall ill, increases baldness or
// makes you car start emitting strange noises when you start it up.
//
// Expect bugs.
// 
// Please use and enjoy. Please let me know of any bugs/mods/improvements 
// that you have found/implemented and I will fix/incorporate them into this
// file. 
//
/////////////////////////////////////////////////////////////////////////////
    
#include "stdafx.h"
#include "SystemTray.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

IMPLEMENT_DYNAMIC(CSystemTray, CWnd)

UINT CSystemTray::m_nIDEvent = 4567;

/////////////////////////////////////////////////////////////////////////////
// CSystemTray construction/creation/destruction

CSystemTray::CSystemTray()
{
    Initialise();
}

CSystemTray::CSystemTray(CWnd* pParent, UINT uCallbackMessage, LPCTSTR szToolTip, 
                         HICON icon, UINT uID)
{
    Initialise();
    Create(pParent, uCallbackMessage, szToolTip, icon, uID);
}

void CSystemTray::Initialise()
{
    memset(&m_tnd, 0, sizeof(m_tnd));
    m_bEnabled   = FALSE;
    m_bHidden    = FALSE;
    m_uIDTimer   = 0;
    m_hSavedIcon = NULL;
    m_DefaultMenuItemID = 0;
    m_DefaultMenuItemByPos = TRUE;
}

BOOL CSystemTray::Create(CWnd* pParent, UINT uCallbackMessage, LPCTSTR szToolTip, 
                         HICON icon, UINT uID)
{
    // this is only for Windows 95 (or higher)
    VERIFY(m_bEnabled = ( GetVersion() & 0xff ) >= 4);
    if (!m_bEnabled) return FALSE;

    // Make sure Notification window is valid (not needed - CJM)
     //VERIFY(m_bEnabled = (pParent && ::IsWindow(pParent->GetSafeHwnd())));
    // if (!m_bEnabled) return FALSE;
    
    // Make sure we avoid conflict with other messages
    ASSERT(uCallbackMessage >= WM_USER);

    // Tray only supports tooltip text up to 64 characters
    ASSERT(_tcslen(szToolTip) <= 64);

    // Create an invisible window
    CWnd::CreateEx(0, AfxRegisterWndClass(0), _T(""), WS_POPUP, 0,0,10,10, NULL, 0);

    // load up the NOTIFYICONDATA structure
    m_tnd.cbSize = sizeof(NOTIFYICONDATA);
    m_tnd.hWnd   = pParent->GetSafeHwnd()? pParent->GetSafeHwnd() : m_hWnd;
    m_tnd.uID    = uID;
    m_tnd.hIcon  = icon;
    m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
    m_tnd.uCallbackMessage = uCallbackMessage;
    _tcscpy(m_tnd.szTip, szToolTip);

    // Set the tray icon
    VERIFY(m_bEnabled = Shell_NotifyIcon(NIM_ADD, &m_tnd));
    return m_bEnabled;
}

CSystemTray::~CSystemTray()
{
    RemoveIcon();
    m_IconList.RemoveAll();
    DestroyWindow();
}

/////////////////////////////////////////////////////////////////////////////
// CSystemTray icon manipulation

void CSystemTray::MoveToRight()
{
    HideIcon();
    ShowIcon();
}

void CSystemTray::RemoveIcon()
{
    if (!m_bEnabled) return;

    m_tnd.uFlags = 0;
    Shell_NotifyIcon(NIM_DELETE, &m_tnd);
    m_bEnabled = FALSE;
}

void CSystemTray::HideIcon()
{
    if (m_bEnabled && !m_bHidden) {
        m_tnd.uFlags = NIF_ICON;
        Shell_NotifyIcon (NIM_DELETE, &m_tnd);
        m_bHidden = TRUE;
    }
}

void CSystemTray::ShowIcon()
{
    if (m_bEnabled && m_bHidden) {
        m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
        Shell_NotifyIcon(NIM_ADD, &m_tnd);
        m_bHidden = FALSE;
    }
}

BOOL CSystemTray::SetIcon(HICON hIcon)
{
    if (!m_bEnabled) return FALSE;

    m_tnd.uFlags = NIF_ICON;
    m_tnd.hIcon = hIcon;

    return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
}

BOOL CSystemTray::SetIcon(LPCTSTR lpszIconName)
{
    HICON hIcon = AfxGetApp()->LoadIcon(lpszIconName);

    return SetIcon(hIcon);
}

BOOL CSystemTray::SetIcon(UINT nIDResource)
{
    HICON hIcon = AfxGetApp()->LoadIcon(nIDResource);

    return SetIcon(hIcon);
}

BOOL CSystemTray::SetStandardIcon(LPCTSTR lpIconName)
{
    HICON hIcon = LoadIcon(NULL, lpIconName);

    return SetIcon(hIcon);
}

BOOL CSystemTray::SetStandardIcon(UINT nIDResource)
{
    HICON hIcon = LoadIcon(NULL, MAKEINTRESOURCE(nIDResource));

    return SetIcon(hIcon);
}
 
HICON CSystemTray::GetIcon() const
{
    return (m_bEnabled)? m_tnd.hIcon : NULL;
}

BOOL CSystemTray::SetIconList(UINT uFirstIconID, UINT uLastIconID) 
{
	if (uFirstIconID > uLastIconID)
        return FALSE;

	UINT uIconArraySize = uLastIconID - uFirstIconID + 1;
	const CWinApp * pApp = AfxGetApp();
    ASSERT(pApp != 0);

    m_IconList.RemoveAll();
    try {
	    for (UINT i = uFirstIconID; i <= uLastIconID; i++)
		    m_IconList.Add(pApp->LoadIcon(i));
    }
    catch (CMemoryException *e)
    {
        e->ReportError();
        e->Delete();
        m_IconList.RemoveAll();
        return FALSE;
    }

    return TRUE;
}

BOOL CSystemTray::SetIconList(HICON* pHIconList, UINT nNumIcons)
{
    m_IconList.RemoveAll();

    try {
	    for (UINT i = 0; i <= nNumIcons; i++)
		    m_IconList.Add(pHIconList[i]);
    }
    catch (CMemoryException *e)
    {
        e->ReportError();
        e->Delete();
        m_IconList.RemoveAll();
        return FALSE;
    }

    return TRUE;
}

BOOL CSystemTray::Animate(UINT nDelayMilliSeconds, int nNumSeconds /*=-1*/)
{
    StopAnimation();

    m_nCurrentIcon = 0;
    m_StartTime = COleDateTime::GetCurrentTime();
    m_nAnimationPeriod = nNumSeconds;
    m_hSavedIcon = GetIcon();

	// Setup a timer for the animation
	m_uIDTimer = SetTimer(m_nIDEvent, nDelayMilliSeconds, NULL);

    return (m_uIDTimer != 0);
}

BOOL CSystemTray::StepAnimation()
{
    if (!m_IconList.GetSize())
        return FALSE;

    m_nCurrentIcon++;
    if (m_nCurrentIcon >= m_IconList.GetSize())
        m_nCurrentIcon = 0;

    return SetIcon(m_IconList[m_nCurrentIcon]);
}

BOOL CSystemTray::StopAnimation()
{
    BOOL bResult = FALSE;

    if (m_uIDTimer)
	    bResult = KillTimer(m_uIDTimer);
    m_uIDTimer = 0;

    if (m_hSavedIcon)
        SetIcon(m_hSavedIcon);
    m_hSavedIcon = NULL;

    return bResult;
}

/////////////////////////////////////////////////////////////////////////////
// CSystemTray tooltip text manipulation

BOOL CSystemTray::SetTooltipText(LPCTSTR pszTip)
{
    if (!m_bEnabled) return FALSE;

    m_tnd.uFlags = NIF_TIP;
    _tcscpy(m_tnd.szTip, pszTip);

    return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
}

BOOL CSystemTray::SetTooltipText(UINT nID)
{
    CString strText;
    VERIFY(strText.LoadString(nID));

    return SetTooltipText(strText);
}

CString CSystemTray::GetTooltipText() const
{
    CString strText;
    if (m_bEnabled)
        strText = m_tnd.szTip;

    return strText;
}

/////////////////////////////////////////////////////////////////////////////
// CSystemTray notification window stuff

BOOL CSystemTray::SetNotificationWnd(CWnd* pWnd)
{
    if (!m_bEnabled) return FALSE;

    // Make sure Notification window is valid
    ASSERT(pWnd && ::IsWindow(pWnd->GetSafeHwnd()));

    m_tnd.hWnd = pWnd->GetSafeHwnd();
    m_tnd.uFlags = 0;

    return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
}

CWnd* CSystemTray::GetNotificationWnd() const
{
    return CWnd::FromHandle(m_tnd.hWnd);
}

/////////////////////////////////////////////////////////////////////////////
// CSystemTray menu manipulation

BOOL CSystemTray::SetMenuDefaultItem(UINT uItem, BOOL bByPos)
{
    if ((m_DefaultMenuItemID == uItem) && (m_DefaultMenuItemByPos == bByPos)) 
        return TRUE;

    m_DefaultMenuItemID = uItem;
    m_DefaultMenuItemByPos = bByPos;   

    CMenu menu, *pSubMenu;

    if (!menu.LoadMenu(m_tnd.uID)) return FALSE;
    if (!(pSubMenu = menu.GetSubMenu(0))) return FALSE;

    ::SetMenuDefaultItem(pSubMenu->m_hMenu, m_DefaultMenuItemID, m_DefaultMenuItemByPos);

    return TRUE;
}

void CSystemTray::GetMenuDefaultItem(UINT& uItem, BOOL& bByPos)
{
    uItem = m_DefaultMenuItemID;
    bByPos = m_DefaultMenuItemByPos;
}

/////////////////////////////////////////////////////////////////////////////
// CSystemTray message handlers

BEGIN_MESSAGE_MAP(CSystemTray, CWnd)
	//{{AFX_MSG_MAP(CSystemTray)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

void CSystemTray::OnTimer(UINT nIDEvent) 
{
    ASSERT(nIDEvent == m_nIDEvent);

    COleDateTime CurrentTime = COleDateTime::GetCurrentTime();
    COleDateTimeSpan period = CurrentTime - m_StartTime;
    if (m_nAnimationPeriod > 0 && m_nAnimationPeriod < period.GetTotalSeconds())
    {
        StopAnimation();
        return;
    }

    StepAnimation();
}

LRESULT CSystemTray::OnTrayNotification(UINT wParam, LONG lParam) 
{
    //Return quickly if its not for this tray icon
    if (wParam != m_tnd.uID)
        return 0L;

    CMenu menu, *pSubMenu;
    CWnd* pTarget = AfxGetMainWnd();

    // Clicking with right button brings up a context menu
    if (LOWORD(lParam) == WM_RBUTTONUP)
    {    
        if (!menu.LoadMenu(m_tnd.uID)) return 0;
        if (!(pSubMenu = menu.GetSubMenu(0))) return 0;

        // Make chosen menu item the default (bold font)
        ::SetMenuDefaultItem(pSubMenu->m_hMenu, m_DefaultMenuItemID, m_DefaultMenuItemByPos);

        // Display and track the popup menu
        CPoint pos;
        GetCursorPos(&pos);

        pTarget->SetForegroundWindow();  
        ::TrackPopupMenu(pSubMenu->m_hMenu, 0, pos.x, pos.y, 0, 
                         pTarget->GetSafeHwnd(), NULL);

        // BUGFIX: See "PRB: Menus for Notification Icons Don't Work Correctly"
        pTarget->PostMessage(WM_NULL, 0, 0);

        menu.DestroyMenu();
    } 
    else if (LOWORD(lParam) == WM_LBUTTONDBLCLK) 
    {
        // double click received, the default action is to execute default menu item
        pTarget->SetForegroundWindow();  

        UINT uItem;
        if (m_DefaultMenuItemByPos)
        {
            if (!menu.LoadMenu(m_tnd.uID)) return 0;
            if (!(pSubMenu = menu.GetSubMenu(0))) return 0;
            uItem = pSubMenu->GetMenuItemID(m_DefaultMenuItemID);
        }
        else
            uItem = m_DefaultMenuItemID;
        
        pTarget->SendMessage(WM_COMMAND, uItem, 0);

        menu.DestroyMenu();
    }

    return 1;
}

LRESULT CSystemTray::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
    if (message == m_tnd.uCallbackMessage)
        return OnTrayNotification(wParam, lParam);
	
	return CWnd::WindowProc(message, wParam, lParam);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产精品一区二区夜夜嗨| 国产成人aaaa| 欧美三级韩国三级日本三斤 | 欧美伊人久久大香线蕉综合69 | 成人激情视频网站| 国产精品久久久久久久裸模| 91亚洲永久精品| 夜夜精品浪潮av一区二区三区| 欧美综合视频在线观看| 午夜激情久久久| 精品国产乱码久久久久久久 | 韩国v欧美v亚洲v日本v| 久久久国产精品麻豆| 成人免费av在线| 一区二区三区产品免费精品久久75| 欧美午夜在线观看| 免费高清在线一区| 国产精品视频yy9299一区| 91美女视频网站| 蜜臀久久久99精品久久久久久| 精品美女在线播放| av在线不卡观看免费观看| 午夜欧美大尺度福利影院在线看| 欧美成人国产一区二区| fc2成人免费人成在线观看播放| 亚洲综合激情另类小说区| 国产亚洲婷婷免费| 在线观看亚洲专区| 国产在线精品一区二区夜色| 国产精品久久99| 欧美精品日韩精品| 国产高清不卡二三区| 亚洲制服丝袜av| 26uuu久久天堂性欧美| 在线观看免费亚洲| 国产毛片精品国产一区二区三区| 亚洲免费观看高清完整版在线观看熊| 欧美丰满一区二区免费视频| 粉嫩av一区二区三区| 日韩电影网1区2区| 亚洲欧美日韩国产手机在线| 精品99一区二区三区| 欧美亚洲国产怡红院影院| 国产成人h网站| 美女网站一区二区| 一区二区三区不卡视频在线观看| 久久久久免费观看| 欧美精品久久一区二区三区| 99久久婷婷国产综合精品| 老司机免费视频一区二区三区| 亚洲女子a中天字幕| 久久久.com| 日韩欧美激情在线| 欧美精选在线播放| 欧洲国内综合视频| 91在线一区二区| 国产成人免费视频一区| 青青草视频一区| 亚洲综合自拍偷拍| 最新久久zyz资源站| 久久精品免视看| 精品国产乱码久久| 日韩精品一区二区三区视频在线观看| 欧美色区777第一页| 91久久精品网| 99久久精品免费看| 成人动漫一区二区三区| 国产剧情一区二区三区| 久久精品国产亚洲aⅴ| 日本成人中文字幕在线视频| 午夜伊人狠狠久久| 性欧美大战久久久久久久久| 一区二区高清视频在线观看| 中文字幕在线观看不卡| 中国av一区二区三区| 中文在线一区二区| 国产精品国产自产拍高清av| 国产女人18毛片水真多成人如厕| 久久亚洲春色中文字幕久久久| 日韩午夜在线观看| 日韩免费观看高清完整版| 欧美一级夜夜爽| 日韩欧美精品在线| 久久亚洲捆绑美女| 日本一区二区免费在线| 国产日韩欧美在线一区| 国产精品国产三级国产aⅴ无密码| 国产精品免费视频观看| 国产精品欧美综合在线| 成人欧美一区二区三区黑人麻豆| 国产精品二三区| 亚洲人吸女人奶水| 亚洲亚洲人成综合网络| 视频一区欧美日韩| 狠狠色丁香婷综合久久| 国产福利一区在线观看| 91麻豆国产福利精品| 欧美影院一区二区三区| 91精品国产欧美一区二区| 欧美大片在线观看| 欧美国产日韩亚洲一区| 亚洲免费在线视频一区 二区| 亚洲一二三级电影| 美日韩黄色大片| 成人在线综合网| 欧美三级一区二区| 欧美xxxxxxxxx| 国产精品超碰97尤物18| 午夜视黄欧洲亚洲| 国产一区二区精品久久91| 99re这里都是精品| 3d动漫精品啪啪| 国产欧美va欧美不卡在线| 亚洲一二三四区| 激情伊人五月天久久综合| 成人高清免费在线播放| 欧美精品欧美精品系列| 国产精品欧美一区喷水| 亚洲国产欧美日韩另类综合 | 麻豆免费精品视频| 成人爽a毛片一区二区免费| 在线观看亚洲专区| 久久久久国产精品厨房| 亚洲在线一区二区三区| 国产成人精品亚洲777人妖| 欧美三级在线看| 国产精品午夜免费| 日本v片在线高清不卡在线观看| www.欧美亚洲| 久久综合网色—综合色88| 亚洲视频每日更新| 国产美女一区二区三区| 欧美精品一二三| 日韩伦理电影网| 国产一区二区伦理| 欧美一区日韩一区| 亚洲黄色小视频| 成人小视频免费在线观看| 欧美一个色资源| 亚洲一区精品在线| 99国产麻豆精品| 国产亚洲午夜高清国产拍精品 | 久久精品国产秦先生| 91免费国产在线观看| 精品成人一区二区三区| 性久久久久久久久久久久| 成人av一区二区三区| 久久久久久99久久久精品网站| 五月婷婷久久丁香| 在线观看不卡一区| 中文字幕在线不卡| 国产精品资源站在线| 日韩一区二区三区免费看| 亚洲第一电影网| 欧洲日韩一区二区三区| 亚洲精品成人少妇| 成人国产免费视频| 国产亚洲欧美日韩俺去了| 久久电影网站中文字幕| 欧美一区二区三区日韩| 午夜精品久久久久久久99樱桃| 色噜噜狠狠成人中文综合| 亚洲丝袜自拍清纯另类| 99vv1com这只有精品| 中文字幕一区免费在线观看| 成人综合婷婷国产精品久久蜜臀| 国产亚洲女人久久久久毛片| 国产伦精品一区二区三区视频青涩| 日韩美女视频一区二区在线观看| 蜜芽一区二区三区| 日韩三级视频中文字幕| 麻豆成人av在线| 久久久综合激的五月天| 国产精品一区二区三区99| 久久午夜老司机| 国产成人在线网站| 国产欧美一区二区精品性色超碰| 丁香一区二区三区| 国产精品久久99| 色欧美片视频在线观看| 亚洲一区二区三区影院| 欧美久久久久免费| 久久精品国产**网站演员| 精品国产伦理网| 豆国产96在线|亚洲| 亚洲欧洲在线观看av| 欧美性高清videossexo| 日本aⅴ亚洲精品中文乱码| 精品精品欲导航| 国产成人av电影在线播放| 亚洲男女一区二区三区| 欧美另类一区二区三区| 精品一区精品二区高清| 国产欧美精品一区二区色综合朱莉 | 99久久久久免费精品国产| 亚洲免费在线视频| 欧美一区二区精品久久911| 国产一区日韩二区欧美三区| 成人免费在线视频| 6080日韩午夜伦伦午夜伦|