You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.5 KiB
C++

2 years ago
<EFBFBD><EFBFBD>//////////////////////////////////////////////////////////////////////////
// Class Name: SShellNotifyIcon
// Description:show ShellNotifyIcon
// Creator: 359501300
// Version: 2014.9.19 - 1.0 - Create
//////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SShellNotifyIcon.h"
SShellNotifyIcon::SShellNotifyIcon()
{
memset(&nid,0,sizeof(nid));
}
SShellNotifyIcon::~SShellNotifyIcon()
{
Hide();
}
void SShellNotifyIcon::Create(HWND hOwner,HICON hIcon,UINT uFlags, UINT uCallbackMessage, UINT uId, LPCSTR szTip)
{
IniNotifyIconData(hOwner,hIcon,uFlags, uCallbackMessage, uId, szTip);
}
BOOL SShellNotifyIcon::Show()
{
//*gROSNotifyIconData
if (nid.cbSize != sizeof(NOTIFYICONDATA))
return FALSE;
return Shell_NotifyIcon(NIM_ADD, &nid);
}
BOOL SShellNotifyIcon::Hide()
{
return Shell_NotifyIcon(NIM_DELETE, &nid);
}
void SShellNotifyIcon::IniNotifyIconData(HWND hOwner,HICON hIcon,UINT flags, UINT callbackmsg, UINT ID, LPCSTR szTip)
{
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hOwner;
nid.uID = ID;
nid.uFlags = flags;//NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = callbackmsg;
nid.hIcon = hIcon;
//_tcscpy_s(nid.szTip, szTip);
strcpy(nid.szTip,szTip);
}