Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8015901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:23:28+00:00 2026-06-04T20:23:28+00:00

I have a function that shows a balloon tray in Windows it has a

  • 0

I have a function that shows a balloon tray in Windows it has a structure too like this:

const
NIF_INFO      =       $00000010;
NIIF_NONE     =       $00000000;
NIIF_INFO     =       $00000001;
NIIF_WARNING  =       $00000002;
NIIF_ERROR    =       $00000003;

type
 BalloonData = record
 cbSize: DWORD;
 Wnd: HWND;
 uID: UINT;
 uFlags: UINT;
 uCallbackMessage: UINT;
 hIcon: HICON;
 szTip: array[0..MAXCHAR] of AnsiChar;
 dwState: DWORD;
 dwStateMask: DWORD;
 szInfo: array[0..MAXBYTE] of AnsiChar;
 uTimeout: UINT;
 szInfoTitle: array[0..63] of AnsiChar;
 dwInfoFlags: DWORD;
end;

type
 TBalloonTimeout = 2..30;
 TBalloonIconType = (bitNone, bitInfo, bitWarning, bitError);

function DZBalloonTrayIcon(const Window: HWND; const IconID: Byte; const Timeout: TBalloonTimeout; const BalloonText, BalloonTitle: String; const BalloonIconType: TBalloonIconType): Boolean;
const
  aBalloonIconTypes : array[TBalloonIconType] of Byte = (NIIF_NONE, NIIF_INFO, NIIF_WARNING, NIIF_ERROR);
var
 TheBalloon : BalloonData;
begin
 FillChar(TheBalloon, SizeOf(BalloonData), 0);
 with TheBalloon do begin
  cbSize := SizeOf(BalloonData);
  Wnd := Window;
  uID := IconID;
  uFlags := NIF_INFO;
  StrCopy(szInfo, pchar(BalloonText));
  uTimeout := Timeout * 1000;
  StrCopy(szInfoTitle, pchar(BalloonTitle));
  dwInfoFlags := aBalloonIconTypes[BalloonIconType];
 end;
 Result := Shell_NotifyIcon(NIM_MODIFY, @TheBalloon);
end;

Usage :

procedure MakeBaloonTray;
var
 TrayIconData : TNotifyIconData;
begin
 DZBalloonTrayIcon(TrayIconData.Wnd, TrayIconData.uID, 2,'Test', 'Test', bitInfo);
end;

then I changed everything to WideString:

const
 NIF_INFO      =       $00000010;
 NIIF_NONE     =       $00000000;
 NIIF_INFO     =       $00000001;
 NIIF_WARNING  =       $00000002;
 NIIF_ERROR    =       $00000003;

type
 BalloonData = record
 cbSize: DWORD;
 Wnd: HWND;
 uID: UINT;
 uFlags: UINT;
 uCallbackMessage: UINT;
 hIcon: HICON;
 szTip: array[0..MAXCHAR] of WideChar;
 dwState: DWORD;
 dwStateMask: DWORD;
 szInfo: array[0..MAXBYTE] of WideChar;
 uTimeout: UINT;
 szInfoTitle: array[0..63] of WideChar;
 dwInfoFlags: DWORD;
end;

type
 TBalloonTimeout = 2..30;
 TBalloonIconType = (bitNone, bitInfo, bitWarning, bitError);

function StrLCopyW(Dest, Source: PWideChar; MaxLen: Cardinal): PWideChar;
var
 Count: Cardinal;
begin
 Result := Dest;
 Count := 0;
 While (Count < MaxLen) and (Source^ <> #0) do begin
  Dest^ := Source^;
  Inc(Source);
  Inc(Dest);
  Inc(Count);
 end;
 Dest^ := #0;
end;


function StrCopyW(Dest, Source: PWideChar): PWideChar;
begin
 Result := StrLCopyW(Dest, Source, MaxInt);
end;

function DZBalloonTrayIcon(const Window: HWND; const IconID: Byte; const Timeout: TBalloonTimeout; const BalloonText, BalloonTitle: WideString; const BalloonIconType: TBalloonIconType): Boolean;
const
  aBalloonIconTypes : array[TBalloonIconType] of Byte = (NIIF_NONE, NIIF_INFO, NIIF_WARNING, NIIF_ERROR);
var
 TheBalloon : BalloonData;
begin
 FillChar(TheBalloon, SizeOf(BalloonData), 0);
 with TheBalloon do begin
  cbSize := SizeOf(BalloonData);
  Wnd := Window;
  uID := IconID;
  uFlags := NIF_INFO;
  StrCopyW(szInfo, pwidechar(BalloonText));
  uTimeout := Timeout * 1000;
  StrCopyW(szInfoTitle, pwidechar(BalloonTitle));
  dwInfoFlags := aBalloonIconTypes[BalloonIconType];
 end;
 Result := Shell_NotifyIcon(NIM_MODIFY, @TheBalloon);
end;

I also tried:

procedure MakeBaloonTray;
var
 TrayIconData   : TNotifyIconData;
 WideStringTest : WideString;
begin
 WideStringTest := 'someunicodechars';
 DZBalloonTrayIcon(TrayIconData.Wnd, TrayIconData.uID, 2,UTF8Encode(WideStringTest), UTF8Encode(WideStringTest), bitInfo);
end;

I thought Windows supports UTF8 in Balloons but I got question marks only.
Any Idea how to show a WideString/Unicode in a balloon?
Thank you for your help 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:23:29+00:00Added an answer on June 4, 2026 at 8:23 pm

    You need to explicitly use the Shell_NotifyIconW (note the W) function and its related WideString structure, both defined in ShellAPI.pas.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery function that shows/hides spans that look like tips when I
I have this function that shows a list of messages in reverse order. protected
I have this function that limits text, lets say to 50 chars like above:
I have a simple function that shows loading spinner while fetching data (usually takes
I have a little function that shows latest activity, it grab timestamp in unix
I have a function that takes an element, and then shows all the other
So I have this function that gets data from database and echoes it. The
I'm a serious newbie in JS, and I have this function that changes div
I have this function that puts some data with Ajax call in a php
I'm making a Facebook-like chat. I want to implement the function that shows/hides the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.