#include <Windows.h>
int main()
{
NOTIFYICONDATA nid;
ZeroMemory(&nid, sizeof(nid));
nid.cbSize = sizeof(nid);
nid.hWnd = NULL;
nid.uID = 1;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_USER;
nid.uTimeout = 15;
HANDLE hIcon = LoadImageW(NULL, L"icon.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
if (hIcon == NULL)
{
}
else
{
nid.hIcon = LoadIcon((HINSTANCE)hIcon, IDI_APPLICATION);
}
lstrcpy(nid.szTip, L"My Notification");
Shell_NotifyIcon(NIM_ADD, &nid);
nid.uFlags = NIF_INFO;
lstrcpy(nid.szInfo, L"message!");
lstrcpy(nid.szInfoTitle, L"Title");
nid.dwInfoFlags = NIIF_ERROR;
Shell_NotifyIcon(NIM_MODIFY, &nid);
Sleep(3000);
Shell_NotifyIcon(NIM_DELETE, &nid);
return 0;
}