How to show balloon tip message in windows notification center(Windows 11)?

Jojo 20 Reputation points
2023-09-08T07:28:01.9766667+00:00

I use this API (Shell_NotifyIcon(NIM_MODIFY, &m_nidIconData);) to show balloon tip

In windows 10, balloon tip message will show in notification center normally.

In windows 11, balloon tip appear normally but it's message not show in notification center.

In win11, use another api to show message in windows notification center?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,232 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
6,060 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Limitless Technology 42,386 Reputation points
    2023-09-08T15:37:43.1466667+00:00

    Hello there,

    If you are flexible with Powershell you can use the below code to achieve this .

    function ShowBalloonTipInfo

    {

    [CmdletBinding()]

    param

    (

    [Parameter()]

    $Text,

    [Parameter()]

    $Title,

    #It must be 'None','Info','Warning','Error'

    $Icon = 'Info'

    )

    Add-Type -AssemblyName System.Windows.Forms

    #So your function would have to check whether there is already an icon that you can reuse.This is done by using a "shared variable", which really is a variable that has "script:" scope.

    if ($script:balloonToolTip -eq $null)

    {

    #we will need to add the System.Windows.Forms assembly into our PowerShell session before we can make use of the NotifyIcon class.

    $script:balloonToolTip = New-Object System.Windows.Forms.NotifyIcon

    }

    $path = Get-Process -id $pid | Select-Object -ExpandProperty Path

    $balloonToolTip.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)

    $balloonToolTip.BalloonTipIcon = $Icon

    $balloonToolTip.BalloonTipText = $Text

    $balloonToolTip.BalloonTipTitle = $Title

    $balloonToolTip.Visible = $true

    #I thought to display the tool tip for one seconds,so i used 1000 milliseconds when I call ShowBalloonTip.

    $balloonToolTip.ShowBalloonTip(1000)

    }

    ShowBalloonTipInfo ("The Notification from Dotnet-helpers : ","Read the latest topics of poweshell from dotnehelpers.com")

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

  2. Jeanine Zhang-MSFT 7,036 Reputation points Microsoft Vendor
    2023-09-11T02:31:25.0133333+00:00

    Hello,

    Welcome to Microsoft Q&A!

    As far as I'm concerned, there is no need to use another API to show message in windows notification center.

    Have you set the Show notifications in notification center for the app?

    User's image

    I suggest you could try the official sample to check whether the message is displayed in the notification center.

    I test the code on win11, the message could be displayed in the notification center.

    And you could refer to the Doc: Notifications and the Notification Area

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.