本文整理汇总了C++中Shell_NotifyIcon函数的典型用法代码示例。如果您正苦于以下问题:C++ Shell_NotifyIcon函数的具体用法?C++ Shell_NotifyIcon怎么用?C++ Shell_NotifyIcon使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Shell_NotifyIcon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ZeroMemory
BOOL CEpgTimerTaskDlg::ChgTipsTaskBar(HWND hWnd, UINT uiID, HICON hIcon, CString strTips)
{
BOOL bRet;
NOTIFYICONDATA stData;
ZeroMemory(&stData, sizeof(NOTIFYICONDATA));
stData.cbSize = sizeof(NOTIFYICONDATA);
stData.hWnd = hWnd;
stData.uID = uiID;
stData.hIcon = hIcon;
stData.uFlags = NIF_ICON | NIF_TIP;
if( strTips.IsEmpty() == false ){
wcsncpy_s(stData.szTip, sizeof(stData.szTip), strTips.GetBuffer(0), sizeof(stData.szTip) );
}
bRet = Shell_NotifyIcon(NIM_MODIFY, &stData);
return bRet;
}
示例2: Shell_NotifyIcon
BOOL CSystemTray::HideIcon()
{
if (!m_bEnabled || m_bRemoved || m_bHidden)
return TRUE;
#ifdef SYSTEMTRAY_USEW2K
if (m_bWin2K)
{
m_tnd.uFlags = NIF_STATE;
m_tnd.dwState = NIS_HIDDEN;
m_tnd.dwStateMask = NIS_HIDDEN;
m_bHidden = Shell_NotifyIcon( NIM_MODIFY, &m_tnd);
}
else
#endif
RemoveIcon();
return (m_bHidden == TRUE);
}
示例3: Shell_NotifyIcon
BOOL CTrayDialog::TrayUpdate()
{
BOOL bSuccess = FALSE;
if (m_bTrayIconVisible)
{
bSuccess = Shell_NotifyIcon(NIM_MODIFY, &m_nidIconData);
if (!bSuccess) {
//ASSERT(0);
return FALSE; // don't delete 'm_hPrevIconDelete' because it's still attached to the tray
}
}
if (m_hPrevIconDelete != NULL)
{
VERIFY( ::DestroyIcon(m_hPrevIconDelete) );
m_hPrevIconDelete = NULL;
}
return bSuccess;
}
示例4: openMonitorIcon
/*
Can be called multiple times
*/
static int openMonitorIcon()
{
NOTIFYICONDATA data;
HICON iconHandle;
HBITMAP go, stop;
static int doOnce = 0;
int rc;
if (app->monitorMenu == NULL) {
app->monitorMenu = LoadMenu(app->appInst, "monitorMenu");
if (! app->monitorMenu) {
mprError("Can't locate monitorMenu");
return MPR_ERR_CANT_OPEN;
}
}
if (app->subMenu == NULL) {
app->subMenu = GetSubMenu(app->monitorMenu, 0);
go = LoadBitmap(app->appInst, MAKEINTRESOURCE(IDB_GO));
rc = GetLastError();
stop = LoadBitmap(app->appInst, MAKEINTRESOURCE(IDB_STOP));
SetMenuItemBitmaps(app->subMenu, MA_MENU_STATUS, MF_BYCOMMAND, stop, go);
}
iconHandle = (HICON) LoadImage(app->appInst, APPWEB_ICON, IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE);
if (iconHandle == 0) {
mprError("Can't load icon %s", APPWEB_ICON);
return MPR_ERR_CANT_INITIALIZE;
}
data.uID = APPWEB_MONITOR_ID;
data.hWnd = app->appHwnd;
data.hIcon = iconHandle;
data.cbSize = sizeof(NOTIFYICONDATA);
data.uCallbackMessage = APPWEB_MONITOR_MESSAGE;
data.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
scopy(data.szTip, sizeof(data.szTip), mprGetAppTitle());
Shell_NotifyIcon(NIM_ADD, &data);
if (iconHandle) {
DestroyIcon(iconHandle);
}
return 0;
}
示例5: ModifyStatusIcon
//-------------------------------------------------
void ModifyStatusIcon()
{
NOTIFYICONDATA tnid;
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = pShMem->hMainDlg;
tnid.uID = ID_VIETKEY_ICON;
if (pShMem->vietKey) {
tnid.hIcon = pShMem->hVietIcon;
lstrcpy(tnid.szTip,_TEXT("Click to turn off Vietnamese mode"));
} else {
tnid.hIcon = pShMem->hEnIcon;
lstrcpy(tnid.szTip,_TEXT("Click to turn on Vietnamese mode"));
}
tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
tnid.uCallbackMessage = pShMem->iconMsgId;
Shell_NotifyIcon(pShMem->iconShown?NIM_MODIFY:NIM_ADD, &tnid);
pShMem->iconShown = 1;
}
示例6: wcsncpy_s
int CH3CDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: 在此添加您专用的创建代码
m_threadInfo.hWnd=this->m_hWnd;
tnd.cbSize=NOTIFYICONDATA_V2_SIZE;
tnd.hWnd=this->m_hWnd;
tnd.uID=IDR_MAINFRAME;
tnd.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP;
tnd.uCallbackMessage=WM_TRAY;
tnd.hIcon=LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_DISCON));
wcsncpy_s(tnd.szTip, _countof(tnd.szTip), _T("H3C 802.1x认证"), 128);
Shell_NotifyIcon(NIM_ADD,&tnd);
return 0;
}
示例7: ZeroMemory
BOOL CEdenDlg::ChgTipsTaskBar(HWND wnd, UINT id, HICON icon, CString tips)
{
BOOL ret=TRUE;
NOTIFYICONDATA data;
ZeroMemory(&data, sizeof(NOTIFYICONDATA));
data.cbSize = sizeof(NOTIFYICONDATA);
data.hWnd = wnd;
data.uID = id;
data.hIcon = icon;
data.uFlags = NIF_ICON | NIF_TIP;
if( tips.IsEmpty() == false ){
wcsncpy_s(data.szTip, sizeof(data.szTip), tips.GetBuffer(0), sizeof(data.szTip) );
}
ret = Shell_NotifyIcon(NIM_MODIFY, &data);
return ret;
}
示例8: toggleCursorClipping
VOID toggleCursorClipping()
{
if (isClippingEnabled)
{
// Freeing the cursor
ClipCursor(NULL);
// Removing the systray tooltip
notificationIconData.szTip[0] = '\0';
// Changing systray icon
notificationIconData.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_INACTIVE));
}
else
{
HWND hWnd = GetForegroundWindow();
if (hWnd != NULL) {
// Clipping cursor
GetWindowText(hWnd, clippedWindowName, MAX_CLIPPED_WINDOW_NAME_SIZE);
clipCursorToWindow(hWnd);
// Changing the systray tooltip
_snwprintf_s(
notificationIconData.szTip,
sizeof(notificationIconData.szTip),
L"Cursor clipped to: %s",
clippedWindowName);
// Changing systray icon
notificationIconData.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ACTIVE));
}
}
Shell_NotifyIcon(NIM_MODIFY, ¬ificationIconData);
isClippingEnabled = !isClippingEnabled;
}
示例9: TRACE0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
NOTIFYICONDATA &tnd = m_notifyData;
tnd.cbSize=sizeof(NOTIFYICONDATA);
tnd.hWnd=this->m_hWnd;
tnd.uID=IDR_MAINFRAME;
tnd.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP;
tnd.uCallbackMessage=WM_MYSYSTRAYNOTIFY;
tnd.hIcon=LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME));
strcpy(tnd.szTip,"菩提字幕");//图标提示为"测试程序"
BOOL rt = Shell_NotifyIcon(NIM_ADD,&tnd);//向任务栏添加图标
if(!rt)
TRACE0("Add systray icon failed!");
return 0;
}
示例10: openTrayIcon
static int openTrayIcon()
{
NOTIFYICONDATA data;
HICON iconHandle;
static int doOnce = 0;
if (trayMenu == NULL) {
trayMenu = LoadMenu(appInst, "trayMenu");
if (! trayMenu) {
mprError(MPR_L, MPR_LOG, "Can't locate trayMenu");
return MPR_ERR_CANT_OPEN;
}
}
if (subMenu == NULL) {
subMenu = GetSubMenu(trayMenu, 0);
}
iconHandle = (HICON) LoadImage(appInst, APPWEB_ICON, IMAGE_ICON, 0, 0,
LR_LOADFROMFILE | LR_DEFAULTSIZE);
if (iconHandle == 0) {
mprError(MPR_L, MPR_LOG, "Can't load icon %s", APPWEB_ICON);
return MPR_ERR_CANT_INITIALIZE;
}
data.uID = APPWEB_TRAY_ID;
data.hWnd = appHwnd;
data.hIcon = iconHandle;
data.cbSize = sizeof(NOTIFYICONDATA);
data.uCallbackMessage = APPWEB_TRAY_MESSAGE;
data.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
mprStrcpy(data.szTip, sizeof(data.szTip), mp->getAppTitle());
Shell_NotifyIcon(NIM_ADD, &data);
if (iconHandle) {
DestroyIcon(iconHandle);
}
return 0;
}
示例11: sizeof
NS_IMETHODIMP
otSystrayWin::Hide()
{
nsresult rv = otSystrayBase::Hide();
if (NS_SUCCEEDED(rv) && mNid) {
NOTIFYICONDATA nid;
nid.cbSize = sizeof(nid);
nid.hWnd = GetHWND();
nid.uFlags = 0;
nid.uID = mNid;
Shell_NotifyIcon(NIM_DELETE, &nid);
systrays[mNid-100] = 0;
mNid = 0;
}
return rv;
}
示例12: ZeroMemory
BOOL CEpgDataCap_BonDlg::AddTaskBar(HWND wnd, UINT msg, UINT id, HICON icon, CString tips)
{
BOOL ret=TRUE;
NOTIFYICONDATA data;
ZeroMemory(&data, sizeof(NOTIFYICONDATA));
data.cbSize = sizeof(NOTIFYICONDATA);
data.hWnd = wnd;
data.uID = id;
data.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
data.uCallbackMessage = msg;
data.hIcon = icon;
if( tips.IsEmpty() == false ){
wcsncpy_s(data.szTip, sizeof(data.szTip), tips.GetBuffer(0), sizeof(data.szTip) );
}
ret = Shell_NotifyIcon(NIM_ADD, &data);
return ret;
}
示例13: ShowTrayIcon
BOOL ShowTrayIcon()
{
NOTIFYICONDATA nid;
ZeroMemory(&nid, sizeof(NOTIFYICONDATA));
nid.cbSize = (DWORD)sizeof(NOTIFYICONDATA);
nid.hWnd = hWnd;
nid.uID = NID_UID;
nid.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP;
nid.dwInfoFlags=NIIF_INFO;
nid.uCallbackMessage = WM_TASKBARNOTIFY;
nid.hIcon = LoadIcon(hInst, (LPCTSTR)IDI_SMALL);
lstrcpy(nid.szTip, szTooltip);
if (lstrlen(szBalloon) > 0)
{
nid.uFlags |= NIF_INFO;
lstrcpy(nid.szInfo, szBalloon);
lstrcpy(nid.szInfoTitle,szTitle);
}
Shell_NotifyIcon(NIM_ADD, &nid);
return TRUE;
}
示例14: channelPopup
//-----------------------------
void channelPopup(const char *title, const char *msg, bool isPopup = true)
{
String both;
if (*title == '\0') return;
both.append(msg);
both.append(" (");
both.append(title);
both.append(")");
trayIcon.uFlags = NIF_ICON|NIF_TIP;
strncpy(trayIcon.szTip, both.cstr(),sizeof(trayIcon.szTip)-1);
trayIcon.szTip[sizeof(trayIcon.szTip)-1]=0;
if (isPopup) trayIcon.uFlags |= 16;
trayIcon.uTimeoutOrVersion = 10000;
strncpy(trayIcon.szInfo,msg,sizeof(trayIcon.szInfo)-1);
strncpy(trayIcon.szInfoTitle,title,sizeof(trayIcon.szInfoTitle)-1);
Shell_NotifyIcon(NIM_MODIFY, (NOTIFYICONDATA*)&trayIcon);
}
示例15: CreateTrayIcon
static void CreateTrayIcon(bool create)
{
NOTIFYICONDATA nim;
DBVARIANT dbVar;
if (!db_get_ts(NULL,MOD_NAME,"ToolTipText",&dbVar))
{
mir_sntprintf(nim.szTip, 64, _T("%s"), dbVar.ptszVal);
db_free(&dbVar);
}
else
lstrcpy(nim.szTip, _T("Miranda NG"));
nim.cbSize = sizeof(nim);
nim.hWnd = g_hListenWindow;
nim.uID = 100;
nim.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nim.hIcon = Skin_GetIcon("hidemim");
nim.uCallbackMessage = WM_USER + 24;
Shell_NotifyIcon(create ? NIM_ADD : NIM_DELETE, &nim);
g_TrayIcon = create;
}