前100分帖:http://community.csdn.net/Expert/topic/5162/5162690.xml?temp=.9366419问题一:请看
http://community.csdn.net/Expert/topic/5162/5162690.xml?temp=.9366419问题二:
如何处理处理Explorer外壳崩溃后任务栏重建消息??例如这个代码如何用SDK改写?
http://www.vckbase.com/document/viewdoc/?id=498
http://community.csdn.net/Expert/topic/5162/5162690.xml?temp=.9366419问题二:
如何处理处理Explorer外壳崩溃后任务栏重建消息??例如这个代码如何用SDK改写?
http://www.vckbase.com/document/viewdoc/?id=498
{
if (message == WM_TASKBARCREATED) {
.....
}
}
SDK的托盘类演示,支持explorer外壳崩溃后重建
http://community.csdn.net/Expert/topic/5162/5162690.xml?temp=.9366419 留个言。
* File Name: TrayIcon.cpp
* Module Name: CTrayIcon
* Copyright (C) by LQ messager
* Description: System taskbar tray icon control
* Author: LiJun
* Create Data: 2005-11-18 Update Data: 2006-11-16
* E-Mail: mailto:[email protected]
*
* NOTE: WIN32 SDK edition
*********************************************************************/
#include "StdAfx.h"
#include <shellapi.h>
#pragma comment(lib, "shell32.lib")#pragma onceclass CTrayIcon
{
public:
CTrayIcon();
~CTrayIcon();
// Set notify message window
BOOL SetNotifyWnd(HWND hWnd, UINT nMessage);
BOOL SetIcon(HICON hIcon); // Set tray icon
BOOL SetIcon(UINT nID); // Set tray icon by resource
HICON GetIcon() const; // Get tray icon handle BOOL SetToolTip(LPCTSTR lpszText); // Set tooltip text
BOOL SetToolTip(UINT nID); // Set tooltip text by resource
UINT GetToolTip(LPTSTR lpszText, int nLength) const; // Get tooltip text
#if (_WIN32_IE >= 0x0500)
BOOL SetBalloonTip(LPCTSTR lpszTitle, LPCTSTR lpszMsg, UINT nTimeout=3000);
BOOL GetBalloonTip(LPTSTR lpszTitle, LPTSTR lpszMsg, UINT* pTimeout) const;
#endif
BOOL ShowTray(BOOL bShow);
private:
NOTIFYICONDATA m_nid;
};CTrayIcon::CTrayIcon()
{
memset(&m_nid, 0, sizeof(NOTIFYICONDATA));
m_nid.cbSize = sizeof(NOTIFYICONDATA);
}CTrayIcon::~CTrayIcon()
{
ShowTray(FALSE);
}BOOL CTrayIcon::SetNotifyWnd(HWND hWnd, UINT nMessage)
{
if(!::IsWindow(hWnd))
return FALSE;
m_nid.hWnd = hWnd; if(nMessage > 0)
{
m_nid.uCallbackMessage = nMessage;
if(!(m_nid.uFlags & NIF_MESSAGE))
m_nid.uFlags |= NIF_MESSAGE;
}
else
{
m_nid.uCallbackMessage = 0;
if(m_nid.uFlags & NIF_MESSAGE)
m_nid.uFlags &= ~NIF_MESSAGE;
}
return Shell_NotifyIcon(NIM_ADD, &m_nid);
}BOOL CTrayIcon::SetIcon(HICON hIcon)
{
ASSERT(hIcon != NULL); if(!(m_nid.uFlags & NIF_ICON))
m_nid.uFlags |= NIF_ICON; m_nid.hIcon = hIcon;
return Shell_NotifyIcon(NIM_MODIFY, &m_nid);
}BOOL CTrayIcon::SetIcon(UINT nID)
{
return SetIcon(::LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(nID)));
}HICON CTrayIcon::GetIcon() const
{
return m_nid.hIcon;
}BOOL CTrayIcon::SetToolTip(LPCTSTR lpszText)
{
if(!(m_nid.uFlags & NIF_TIP))
m_nid.uFlags |= NIF_TIP;
lstrcpy(m_nid.szTip, lpszText); return Shell_NotifyIcon(NIM_MODIFY,&m_nid);
}BOOL CTrayIcon::SetToolTip(UINT nID)
{
TCHAR szText[128];
::LoadString(GetModuleHandle(NULL), nID, szText, 128);
return SetToolTip(szText);
}UINT CTrayIcon::GetToolTip(LPTSTR lpszText, int nLength) const
{
lstrcpy(lpszText, m_nid.szTip);
return lstrlen(lpszText);
}#if (_WIN32_IE >= 0x0500)
BOOL CTrayIcon::SetBalloonTip(LPCTSTR lpszTitle, LPCTSTR lpszMsg, UINT nTimeout/*=3000*/);{
if(!(m_nid.uFlags & NIF_INFO))
m_nid.uFlags |= NIF_INFO;
m_nid.uTimeout = nTimeout;
lstrcpy(m_nid.szInfoTitle, lpszTitle);
lstrcpy(m_nid.szInfo, lpszMsg); return Shell_NotifyIcon(NIM_MODIFY, &m_nid);
}
#endif#if (_WIN32_IE >= 0x0500)
BOOL CTrayIcon::GetBalloonTip(LPTSTR lpszTitle, LPTSTR lpszMsg, UINT* pTimeout) const
{
lstrcpy(lpszTitle, m_nid.szInfoTitle);
lstrcpy(lpszMsg, m_nid.szInfo);
*pTimeout = m_nid.uTimeout;
return TRUE;
}
#endifBOOL CTrayIcon::ShowTray(BOOL bShow)
{
return Shell_NotifyIcon( bShow ? NIM_ADD : NIM_DELETE, &m_nid );
}
谢谢,不用了。