Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
TrayNotifications.cpp
Go to the documentation of this file.
1#include "TrayNotifications.h"
2#include "resource.h"
3#include <shellapi.h>
4#include <strsafe.h>
5
10BOOL TrayNotifications::Tray::ShowTrayIconBalloon(LPCSTR pszTitle, LPCSTR pszText)
11{
12 NOTIFYICONDATAA nid = {};
13 nid.cbSize = sizeof(NOTIFYICONDATAA);
14 nid.hWnd = GetActiveWindow(); // Or use your main window handle
15 nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP | NIF_INFO;
16 nid.uTimeout = 5000;
17 nid.dwInfoFlags = NIIF_INFO | NIIF_USER ;
18 nid.uVersion = NOTIFYICON_VERSION_4;
19 nid.hIcon = (HICON)LoadImageA(
20 NULL,
21 "assets\\panoptes-head.ico",
22 IMAGE_ICON,
23 128,
24 128,
25 LR_LOADFROMFILE | LR_SHARED
26 );
27
28 if (nid.hIcon == NULL)
29 return FALSE;
30
31 if (StringCchCopyA(nid.szInfoTitle, 64, pszTitle) != S_OK)
32 return FALSE;
33
34 if (StringCchCopyA(nid.szTip, 128, "Panoptes EDR") != S_OK)
35 return FALSE;
36
37 if (StringCchCopyA(nid.szInfo, 256, pszText) != S_OK)
38 return FALSE;
39
40 Shell_NotifyIconA(NIM_ADD, &nid);
41 Sleep(5000);
42 return Shell_NotifyIconA(NIM_DELETE, &nid);
43}
44
static BOOL ShowTrayIconBalloon(LPCSTR pszTitle, LPCSTR pszText)
Display a tray icon balloon notification.
int BOOL
Definition inject.h:3