How to display text in system tray icon with win32 API?

后端 未结 3 1035
萌比男神i
萌比男神i 2021-02-06 02:26

Trying to create a small monitor application that displays current internet usage as percentage in system tray in C using win32 API.

Also wanting to use colour backgrou

3条回答
  •  佛祖请我去吃肉
    2021-02-06 03:20

    By text you mean "Tips" ?

    Assuming you have your icon on the System Tray

    NOTIFYICONDATA _stNotifyIconData;
    
    // For a simple Tip
    _stNotifyIconData.uFlags = NIF_TIP;
    strcpy_s(_stNotifyIconData.szTip, "Little Tip"); // Copy Tip    
    Shell_NotifyIcon(NIM_MODIFY, &_stNotifyIconData);
    
    // For a Ballon Tip
    _stNotifyIconData.uFlags = NIF_INFO;
    strcpy_s(_stNotifyIconData.szInfoTitle, "Title of the Ballon"); // Title
    strcpy_s(_stNotifyIconData.szInfo, "Text..." ); // Copy Tip
    _stNotifyIconData.uTimeout = 3000;  // 3 Seconds
    _stNotifyIconData.dwInfoFlags = NIIF_INFO;
    
    Shell_NotifyIcon(NIM_MODIFY, &_stNotifyIconData);
    

提交回复
热议问题