question

DangDKhanh-2637 avatar image
0 Votes"
DangDKhanh-2637 asked RLWA32-6355 answered

Try to creat bubble notification!

Hi,
I am using the following code after googling to generate a message:

 NOTIFYICONDATA nid = {};
     AllocConsole();
     HWND h =...// ;
    
     nid.cbSize = sizeof(nid);
     nid.hWnd = h;
     nid.uFlags = NIF_ICON | NIF_TIP | NIF_INFO;
    
     nid.hIcon = (HICON)LoadImage(NULL, L"F:\\_el.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_SHARED);
     memcpy(nid.szTip, "MY TOOLTIP!", 128);
     memcpy(nid.szInfoTitle, "Hello", 64);
     //nid.dwInfoFlags =
    
     Shell_NotifyIcon(NIM_ADD, &nid);
     _getch();
     Shell_NotifyIcon(NIM_DELETE, &nid);


But unfortunately I can't run the code.

I am using Use Standard Windows Libraries and also referenced shell32.lib
try compiling then i get this error:

145705-image.png



Can you show me how to fix this?

Thanks you.

c++
image.png (7.0 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Hi,
This way is working temporarily for me:

145744-image.png




Please let me know if you have any other ideas.

0 Votes 0 ·
image.png (20.0 KiB)

1 Answer

RLWA32-6355 avatar image
0 Votes"
RLWA32-6355 answered

There is a sample from Microsoft available at NotificationIcon


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.