🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6493

Re: Displaying Baloon tips in the taskbar

#6493
From: Vladimir Stefanovic
Date: Wed, 04 May 2005 11:49
73 lines
3486 bytes
Hi,

Displaying balloon tips in tray is easy. This is the fragment of
my code, and I copy/past-ed it without changes. You have to
remove some parts, to adjust your needs:

I will just add some comments now to make it easier to you to understand...

      if ( Tray == 1 ) // <-- If I configurably want my app to be in tray
      {
         AddIcon(); // <--Here you must have a code to add a tray icon
         IsIconPresent = true; // <-- Simple way to know is my icon in tray


         if ( Tips ) // <-- if I want tips
         {
            NOTIFYICONDATA IconData;
            IconData.cbSize = sizeof( NOTIFYICONDATA );
            IconData.uID    = IDC_SER_BALLOON_DISMALL;
            IconData.hWnd   = Handle;
            IconData.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;
            IconData.uCallbackMessage = WM_TRAYNOTIFY;
            // X() is my custom function to return a simple AnsiString. You 
should use just "Some title"
            lstrcpy( IconData.szTip, 
X(IDS_SER_MAIN_APPLICATION_TITLE).c_str() );
            IconData.hIcon  = TrayIcon->Handle;

            // SKIP THIS. It's just a mechanism to display different tip of 
the day, every day
            long number = DayOfTheYear( Now() );
            long position = 0;

            long AFrom = IDS_SER_MAIN_TIPS_01;
            long ATo   = IDS_SER_MAIN_TIPS_29;

            long module = ( ( ATo - AFrom ) / 2 ) + 1;

            ++position;

            long to_show = ( number + position ) % module;

            AnsiString Caption = X(IDS_SER_MAIN_HELPTIPOFTHEDAY);
            AnsiString Body = X( to_show * 2 + AFrom );
            //  SKIP TILL THIS LINE

            IconData.dwInfoFlags = NIIF_INFO;
            //IconData.dwInfoFlags = NIF_TIP;

            IconData.uFlags = NIF_INFO;
            IconData.uTimeout = 15000;
            StrLCopy( IconData.szInfo, Body.c_str(), 255 );
            StrLCopy( IconData.szInfoTitle, Caption.c_str(), 63 );
            Shell_NotifyIcon( NIM_MODIFY, &IconData );
         }
      }
      else
      {
         IsIconPresent = false;
      }


-- 
Best regards,
Vladimir Stefanovic
"Danila Vershinin" <danprep@yahoo.com> wrote in message 
news:42762d6f@newsgroups.borland.com...
> Anyone knows how to display that baloon tips? like ones you can see when a 
> disk
> is running out of space.
>
>
> 
Technical Details
Message-ID: <4278b6a6@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42762d6f@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,592a743b28e0761c
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Vladimir Stefanovic" <antivari@po.sbb.co.yu>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42762d6f@newsgroups.borland.com>
Subject: Re: Displaying Baloon tips in the taskbar
Date: Wed, 4 May 2005 13:49:03 +0200
Lines: 75
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 82.117.212.65
Message-ID: <4278b6a6@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1115207334 82.117.212.65 (4 May 2005 04:48:54 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail