托盘气球提示(例)

#include <tchar.h>
#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
NOTIFYICONDATA nid = {0};
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = GetDesktopWindow();
nid.uID = 1001;
nid.uFlags = NIF_ICON | NIF_INFO;
nid.hIcon = LoadIcon(NULL, IDI_INFORMATION);
nid.hBalloonIcon = LoadIcon(NULL, IDI_INFORMATION);

nid.dwInfoFlags = NIIF_INFO;
_tcscpy(nid.szInfoTitle, _T("Title1"));
_tcscpy(nid.szInfo, _T("Info1"));

Shell_NotifyIcon(NIM_ADD, &nid);

Sleep(2000);

nid.dwInfoFlags = NIIF_WARNING;
_tcscpy(nid.szInfoTitle, _T("Title2"));
_tcscpy(nid.szInfo, _T("Info2"));

Shell_NotifyIcon(NIM_MODIFY, &nid);

Sleep(2000);

Shell_NotifyIcon(NIM_DELETE, &nid);

return 0;
}

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注