Try to creat bubble notification!

DangDKhanh-2637 941 Reputation points
2021-11-02T07:11:48.46+00:00

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++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,518 questions
{count} votes

0 additional answers

Sort by: Most helpful