Click here to Skip to main content
Email Password   helpLost your password?
Release #3: Previous release: Ports:

Update Notes

The primary reason for this release is a bug I found with the open location feature: it would access deallocated memory! In addition, I've worked in a few other changes to make writing custom LaunchBalloon() methods easier, fixed a bug in the demo, and added two new options:

unDELAY_CLOSE works in tandem with a timeout value to delay the action caused by the other unCLOSE_* options. This allows you to keep a balloon active indefinately (until the user gets back from coffee break, etc. and has time to take a look at it). For long timeout values, I'd advise also using unSHOW_CLOSE_BUTTON so the user can still get rid of it quickly if need be.

unDISABLE_XP_SHADOW is exactly what it sounds like: if set, that cool dropshadow XP uses for tooltips and menus isn't shown. Note that the user can also disable dropshadows globally, in which case this option has no effect.

I want to add some new demos, there are more things that can be done with this than what I'm currently demonstrating, but I felt these bug fixes needed to be released, and I'm probably too lazy to get the demos done as soon as i'd like anyway. So, I'll do another update when they are finished. In the meantime, Rama Krishna either has already, or will soon be releasing his .NET Version, so there'll be plenty of Balloon Goodness around. :)

Balloons
CBalloonHelp test app, running under Windows XP.

Introduction
Using CBalloonHelp
API
   Important stuff
   SetAnchorPoint()
   SetBackgroundColor()
   SetForegroundColor()
   SetTitle()
   SetContent()
   SetTitleFont()
   SetContentFont()
   SetURL()
   SetIcon()
   LaunchBalloon()
Features
Compatibility
Internals
Updates
Related Articles
TODO
Thanks

Introduction

I hate message boxes.

Or really, I hate MessageBox()s. Something about having a form of output sooo convenient, a single function call, no need for resources to be added, for interfaces to be designed, for any planning or preparation at all � not even a window handle is needed (!) � seems almost to force programmers to use it whenever there is any doubt about what the user should know. Is there a chance a user will perform an action in error? Better get confirmation... Just pop up a MessageBox()!  I can't delete a file in the windows explorer without having to click through at least one MessageBox(). Am I sure? But, the file is executable... Am i really sure? But, it might affect registered programs... Am I really, really sure? ... If a check box was provided to let you hide the message in the future... But that would require extra effort, and there's this ready to use, almost good enough function that will suffice...

But worse yet are programs that feel the need to inform you, after performing an action that you explicitly requested, that the action has indeed been performed, using � you guessed it � MessageBox(). Nothing wrong with a little feedback, especially if the action had effects not necessarily intuitive to first-time users, but to do it in a way that requires you to stop what you're doing, (and what is sometimes worse, what the program is doing) just to acknowledge it... That is not funny.

OK...

Enough hypocritical griping however. Solutions do exist � creating message boxes with check boxes or �yes to all� / �no to all� buttons is not difficult. For the purpose of feedback, displaying a short message in a status bar will often suffice, or possibly adding a log pane. But both of these options really only work for the main window of an application, and have other drawbacks in terms of visibility and screen real-estate as well.

With Windows 2000, Microsoft began a practice of using balloons (of the comic strip dialog variety) for displaying messages from system tray icons. This seems to work quite well; when I dial into the Internet, once the connection is made, a small icon appears in the tray, along with a balloon giving details on my connection speed. A MessageBox() here would be inexcusable, but a balloon is small, unobtrusive, and does not require any action on my part. After a few seconds, it quietly fades away. Windows XP provides this feature for many more tray icons, from system updates to the activation reminder, adding another feature to them in the form of a close button that will dismiss the balloon instantly, in case I'm annoyed by it and don't want to wait for it to time out. (Windows XP also uses similar balloons in other situations, but that fits more in line with the general XP aping of MacOS...)

Note that balloons as described above are not ToolTips. ToolTips, also in use by tray icons by the way, serve well in their current form: small unobtrusive pieces of text that show up when you hover the mouse over a control, and disappear immediately upon moving the mouse away. Anyone who has used BalloonHelp on the MacOS (Ref: http://developer.apple.com/techpubs/mac/HIGuidelines/HIGuidelines-240.html) should know the advantages Microsoft's ToolTips have when used for this purpose.

With Internet Explorer 5 and later, Microsoft make the Balloon ToolTip style available for general use (via the TTS_BALLOON style). But it is not very simple to use, and of course not useable at all on systems without IE5.

So get to the point already...

The point of all this of course is that I've written an easy to use balloon control. I stress easy to use: in order to convince myself and others to go this way, I wanted it to be as easy to pop up a help balloon as popping up a MessageBox().

Using CBalloonHelp

Add BalloonHelp.cpp and BalloonHelp.h in your project.

API

The important stuff

The easiest way to create a balloon is to use the LaunchBalloon() static function:

void CBalloonHelp::LaunchBalloon(const CString& strTitle, 
                                 const CString& strContent, 
      const CPoint& ptAnchor, 
      LPCTSTR szIcon /*= IDI_EXCLAMATION*/
      unsigned int unOptions /*= unSHOW_CLOSE_BUTTON*/,
      CWnd* pParentWnd /*= NULL*/,
      const CString strURL /*= ""*/,
      unsigned int unTimeout /*= 10000*/)

This will allocate a new CBalloonHelp object, create the window, and show it. When the window closes, the CBalloonHelp object will be deleted automatically. Parameters are as follows:

strTitle    //  Title of balloon


strContent  //  Content of balloon


ptAnchor    //  point tail of balloon  will  be "anchor"ed to.

            //  This is  in client coordinates if pParentWnd is given, 

            //  otherwise it is in screen coordinates.


szIcon      //  One of:

            //    IDI_APPLICATION

            //    IDI_INFORMATION IDI_ASTERISK (same)

            //    IDI_ERROR IDI_HAND (same)

            //    IDI_EXCLAMATION IDI_WARNING (same)

            //    IDI_QUESTION

            //    IDI_WINLOGO


unOptions   /*  One or more of: 
     unCLOSE_ON_LBUTTON_DOWN |  closes window on WM_LBUTTON_DOWN
     unCLOSE_ON_MBUTTON_DOWN |  closes window on WM_MBUTTON_DOWN
     unCLOSE_ON_RBUTTON_DOWN |  closes window on WM_RBUTTON_DOWN
     unCLOSE_ON_LBUTTON_UP   |  closes window on WM_LBUTTON_UP
     unCLOSE_ON_MBUTTON_UP   |  closes window on WM_MBUTTON_UP
     unCLOSE_ON_RBUTTON_UP   |  closes window on WM_RBUTTON_UP
     unCLOSE_ON_MOUSE_MOVE   |  closes window when user moves mouse 
                             |    past threshhold
     unCLOSE_ON_KEYPRESS     |  closes window on the next keypress message 
                                 sent to this thread.
     unCLOSE_ON_ANYTHING     |  all of the above.
     unDELAY_CLOSE           |  when a user action triggers the close, 
                             |   begins timer.  closes when timer expires.
     unSHOW_CLOSE_BUTTON     |  shows close button in upper right
     unSHOW_INNER_SHADOW     |  draw inner shadow in balloon
     unSHOW_TOPMOST          |  place balloon above all other windows
     unDISABLE_XP_SHADOW     |  disable Windows XP's drop-shadow effect 
                             |   (overrides system and user settings)
     unDISABLE_FADE          |  disable the fade-in/fade-out effects 
                             |   (overrides system and user settings)
     unDISABLE_FADEIN        |  disable the fade-in effect
     unDISABLE_FADEOUT       |  disable the fade-out effect
*/

pParentWnd  //  Parent window/anchor window.  If NULL, balloon will be 

            //  anchored in screen coordinates, and owned by the 

            //  application's main window.

strURL      //  If not empty, when the balloon is clicked ShellExecute() 

            //  will be called, with strURL passed in.

unTimeout   //  If not 0, balloon will automatically close after unTimeout 

            //  milliseconds.

Use:

CBalloonHelp::LaunchBalloon("BoogaBooga", 
     "What the hell is \"Booga Booga\" supposed to mean, anyway?", 
     CPoint(0,0));

CBalloonHelp::LaunchBalloon("You are holding down the right mouse button!", 
     "Blah", Cpoint(0,0), IDI_WARNING, 
      CballoonHelp::unCLOSE_ON_RBUTTON_UP|CBalloonHelp::unSHOW_INNER_SHADOW, 
                                          this, "", 0);

The first line above will show a balloon with the title �BoogaBooga� and associated message anchored to the top left corner of the screen (point is in screen coordinates). Ideally, you'd anchor it to something more meaningful, such as the center of a control, or a status bar icon. The default options will cause this balloon to disappear after 10 seconds, and to show the standard information icon at top left, and a close button at top right.

The second line above will show a balloon, this time anchored to the top left corner of the window represented by this, this time with the standard warning icon. The CBalloonHelp::unCLOSE_ON_RBUTTON_UP option will cause it to be destroyed when the right mouse button is released � if a mouse button is being held down, then mouse input is captured, so the balloon will close whenever the right mouse button is released. If no mouse button is held down, the user will have to release the right mouse button somewhere in a window owned by the same thread in order for it to close. The CballoonHelp::unSHOW_INNER_SHADOW option will cause the balloon to be drawn with an inner hilight and shadow... Not all that interesting, but if you're not running on Windows XP, it's the only shadow you can get.

It is also possible to create a balloon using the Create function, in which case you can opt not to have the object automatically deleted when the window closes (the LaunchBalloon function always adds the option CBalloonHelp::unDELETE_THIS_ON_CLOSE to force this, but it may not be desirable if, for instance, you allocate a CBalloonHelp object from the stack). This function gives much greater potential for customization as well (see below for more info).

Complete API

"API Create">BOOL CBalloonHelp::Create(const CString& strTitle, 
               const CString& strContent, 
               const CPoint& ptAnchor, unsigned int unOptions,
               CWnd* pParentWnd /*=NULL*/,
               const CString strURL /*= ""*/,
               unsigned int unTimeout /*= 0*/,
               HICON hIcon /*= NULL*/);
      

This will create and display a balloon window. Title and content override any set for the object prior to this call. ptAnchor indicates anchor location in screen coordinates. unOptions should be a combination of one or more of the following:

CBalloonHelp::unCLOSE_ON_LBUTTON_DOWN //  closes window on WM_LBUTTON_DOWN

CBalloonHelp::unCLOSE_ON_MBUTTON_DOWN //  closes window on WM_MBUTTON_DOWN

CBalloonHelp::unCLOSE_ON_RBUTTON_DOWN //  closes window on WM_RBUTTON_DOWN

CBalloonHelp::unCLOSE_ON_LBUTTON_UP   //  closes window on WM_LBUTTON_UP

CBalloonHelp::unCLOSE_ON_MBUTTON_UP   //  closes window on WM_MBUTTON_UP

CBalloonHelp::unCLOSE_ON_RBUTTON_UP   //  closes window on WM_RBUTTON_UP

CBalloonHelp::unCLOSE_ON_RBUTTON_UP   //  closes window on WM_RBUTTON_UP

CBalloonHelp::unCLOSE_ON_MOUSE_MOVE   //  closes window when user moves mouse past 

                                      //  threshhold

CBalloonHelp::unCLOSE_ON_KEYPRESS     //  closes window on the next keypress message sent

                                      //  to this thread.

CBalloonHelp::unCLOSE_ON_ANYTHING;    //  all of the above

CBalloonHelp::unDELAY_CLOSE;          //  when a user action triggers the close, 

                                      //  begins timer.  closes when timer expires.

CBalloonHelp::unDELETE_THIS_ON_CLOSE  //  deletes object when window is closed.  Used by 

                                      //  LaunchBalloon(), use with care

CBalloonHelp::unSHOW_CLOSE_BUTTON     //  shows close button in upper right

CBalloonHelp::unSHOW_INNER_SHADOW     //  draw inner shadow in balloon

CBalloonHelp::unSHOW_TOPMOST          //  place balloon above all other windows

CBalloonHelp::unDISABLE_XP_SHADOW;    //  disable Windows XP's drop-shadow effect 

                                      //  (overrides system and user settings)

CBalloonHelp::unDISABLE_FADE          //  disable the fade-in/fade-out effects 

                                      //  (overrides system and user settings)

CBalloonHelp::unDISABLE_FADEIN        //  disable the fade-in effect

CBalloonHelp::unDISABLE_FADEOUT       //  disable the fade-out effect

      

If pParentWnd is NULL, the balloon will be anchored in screen coordinates, and owned by the application's main window (AfxGetMainWnd()). If there is no main window, and pParentWnd is NULL, creation will fail. strURL if not empty will be passed to ShellExecute() when the balloon is clicked. If not 0, unTimeout specifies the time in milliseconds until the balloon closes automatically. And hIcon if not NULL specifies the icon shown in the upper left corner of the balloon; it is copied on creation, so the icon can safely be destroyed after Create() returns.

"API SetAnchorPoint">void CBalloonHelp::SetAnchorPoint(CPoint ptAnchor, CWnd* pWndAnchor = NULL);      

Sets the point to which the balloon is anchored (the point the balloon's tail attaches to). Calling this before the balloon is created has no effect, since the anchor is a required parameter of Create(). If pWndAnchor is NULL, ptAnchor is assumed to be in screen coordinates, otherwise it is assumed to be relative to the client area of pWndAnchor

"API SetBackgroundColor">void CBalloonHelp::SetBackgroundColor(COLORREF crBackground);

Sets the background color of the balloon. Can be called before or after the balloon is created.

"API SetForegroundColor">void CBalloonHelp::SetForegroundColor(COLORREF crForeground);

Sets the foreground (borders & text) color of the balloon. Can be called before or after the balloon is created.

"API SetTitle">void CBalloonHelp::SetTitle(const CString& strTitle);

Sets the title of the balloon. Can be called before or after the balloon is created.

"API SetContent">void CBalloonHelp::SetContent(const CString& strContent);

Sets the content of the balloon. Can be called before or after the balloon is created.

"API SetTitleFont">void CBalloonHelp::SetTitleFont(CFont* pFont);

Sets the font used to draw the title of the balloon. Can be called before or after the balloon is created. The font and the CFont object are stored and eventually deleted by the balloon; do not use either after calling this function.

"API SetContentFont">void CBalloonHelp::SetContentFont(CFont* pFont);    

Sets the font used to draw the contents of the balloon. Can be called before or after the balloon is created. If this is called before creation, and the title font is not explicitly set (via SetTitleFont()) then a bold version of this font is used for the title (even if this font is already bold). The font and the CFont object are stored and eventually deleted by the balloon; do not use either after calling this function.

"API SetURL">void CBalloonHelp::SetURL(const CString& strURL);    

Sets the URL or file to be opened by the balloon when clicked. Set to "" to disable. Can be called before or after the balloon is created.

"API SetIcon">void CBalloonHelp::SetIcon(HICON hIcon);    

Sets the icon shown at the top left of the balloon. Pass in NULL to show no icon. Icon will not be scaled. Can be called before or after the balloon is created.

void CBalloonHelp::SetIcon(HBITMAP hBitmap, COLORREF crMask);
      

Sets the icon shown at the top left of the balloon. crMask indicates transparent color. Pass in NULL for hBitmap to show no icon. Icon will not be scaled. Can be called before or after the balloon is created.

void CBalloonHelp::SetIcon(HBITMAP hBitmap, HBITMAP hMask);

Sets the icon shown at the top left of the balloon. hMask indicates the transparent areas. Both parameters must be valid. Icon will not be scaled. Can be called before or after the balloon is created.

void CBalloonHelp::SetIcon(CImageList* pImageList, int nIconIndex);

Sets the icon shown at the top left of the balloon. nIconIndex indicates image to use. Both parameters must be valid. Icon will not be scaled. Can be called before or after the balloon is created.

"API LaunchBalloon">void CBalloonHelp::LaunchBalloon(const CString& strTitle, 
               const CString& strContent, 
               const CPoint& ptAnchor, 
               LPCTSTR szIcon /*= IDI_EXCLAMATION*/,
               unsigned int unOptions /*= unSHOW_CLOSE_BUTTON*/,
               CWnd* pParentWnd /*= NULL*/,
               const CString strURL /*= ""*/,
               unsigned int unTimeout /*= 10000*/)

Creates and shows a balloon. This is a static function, so calling this on an instance of CBalloonHelp is not too useful. If you need more control, create a derived class, or use Create() and associated property functions. See Use for more information.

Features

Compatibility

Tested on Windows XP, 2000, 98, and 95

Compiles with VC++ 6.0 / MFC 6 and VC++.NET / MFC 7

Internals

CBalloonHelp is an MFC class, derived from CWnd. The first time a balloon is created, a window class named �BalloonHelpClass� is registered. First, a window class with the CS_DROPSHADOW style is registered; if registration fails, the style is removed, and registration is attempted again. This allows use of the style on Windows XP, while avoiding problems on previous versions of Windows.

The window is created hidden, and then the size of the content and title are calculated. Margins and space for the tail are added to this, and the window is sized and positioned relative to the anchor point. Finally, the window region is set and the window is shown.

Tip: when doing shaped windows, put the shaped bits in the non-client area; it's a lot easier to deal with if you don't have to account for that stuff when dealing with drawing the client area.

AnimateWindow() is used for the fade-in/fade-out effects if available and requested.

Messsage hooks are used to determine when closing mouse actions occur.

Andrew Nosenko's CAuxThunk implementation (renamed to _ThunkImpl) is used for implementing message hooks.

Updates

8/2/02

5/30/02

1/23/02

12/31/01

12/21/01

12/12/01

Related Articles

TODO

Clean up code a bit... most of it is pretty straight forward, but documentation could be better.

Move to straight Win32, not MFC derived class.

Add better code walkthrough to this article.

Thanks...

...Jan van den Baard for showing me the right way to use AnimateWindow(), and for demonstrating how WM_NCHITTEST can be used to provide hot tracking. Check out his ClassLib library on CP!

...Maximilian H�nel for his WTL port, and for demonstrating therein a nicer way to handle message hooks.

...To all the people who've provided feedback, positive and negative. It all helps.

...To Mustafa Demirhan, for his suggestion and information on using keyboard hooks.

...To The Code Project, for providing a useable forum for all of us.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralGetting crashed in IE8
Dec1234
2:14 30 Jun '09  
I am using this balloon with ActiveX component that runs under IE, everything is fine till IE7. But in IE8 it gets crashed(to be very specific in CreateEx()) funtion. Another clue is, this crash is not happening in all machines, but in few machines.

Your help is much appreciated.
QuestionHow to integrate with C#?
Member 4092753
21:17 18 Jan '09  
Hi Shog,
Thank you for sharing the application.This was the one I searched for long time.Is it possible to integrate this Balloon Help in C# application .As a C# Developer, I need your help on this.

Thanks,
Mathi.
AnswerRe: How to integrate with C#?
Shog9
8:30 26 Jan '09  
There are several native .NET implementations. For instance:
http://www.codeproject.com/KB/miscctrl/balloonnet.aspx[^]

You must be careful in the forest
Broken glass and rusty nails
If you're to bring back something for us
I have bullets for sale...

QuestionDo not use the second screen
Nacereddine
1:10 31 Mar '08  
Hi, I'm using the balloon control a will in my app, but when i tried it on a configuration with two screens, it does not display on the second screen !

What's wrong ? please any indication to resolve this issue.

btw, good work Rose
GeneralRe: Do not use the second screen
Shog9
5:54 31 Mar '08  
The balloon will appear on the same screen as the anchor point you specify.

Citizen 20.1.01
'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'

GeneralCan we specify the side for the AnchorPoint?
jlundberg
7:26 19 Sep '07  
I want to have my Balloon on the top with the AnchorPoint at the bottom. Anyone know how to do this?

John
GeneralResource leak
bryan_f
10:29 18 Sep '07  
In CBalloonHelp::SetIconScaled, there is a call to CBitmap::CreateCompatibleBitmap for bmpIcon, but there is no call to CBitmap::DeleteObject. According to the documentation for CreateCompatibleBitmap, deletion of the bitmap object is required.
GeneralRe: Resource leak
Shog9
18:43 11 Oct '07  
The call is made in the destructor for CGdiObject (from which CBitmap is derived).


every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- Chris Losinger, Online Poker Players?

GeneralClosing
jlundberg
4:24 17 Sep '07  
Hello,

What is the best way to manually close a Balloon? I will be using one or both of these types:

CBalloonHelp::LaunchBalloon("test1",
"I'm here", CPoint(0,200), IDI_WARNING,
CBalloonHelp::unCLOSE_ON_RBUTTON_UP|CBalloonHelp::unSHOW_INNER_SHADOW, this, "", 0);

or


CRect rect;
GetClientRect(&rect);
bhPersistent.Create("2", "Press Here", (0,80), CBalloonHelp::unSHOW_TOPMOST|CBalloonHelp::unSHOW_INNER_SHADOW|CBalloonHelp::unDISABLE_XP_SHADOW, this);

I want to keep the original dialog up and just display balloons that I can close not using a timmer or user interface.

Please let me know if you can help.

Thanks,

John


GeneralWindow activation / fix
Joergen Sigvardsson
2:19 13 Sep '07  
Hello again,

one thing that annoyed me a little, is that the balloon tip is activated when clicked. This produces unnecessary flicker. The solution is to return MA_NOACTIVATE from OnMouseActivate().


GeneralBugfix
Joergen Sigvardsson
0:39 13 Sep '07  
Hey Shog,

there's a small bug regarding the delay close. If I interpret your header file correctly, the balloon should close itself after a delay, if I specify unDELAY_CLOSE. Unfortunately, its logic is reversed.
void ShowBalloon(void)
{
ShowWindow(SW_SHOWNOACTIVATE);
if ( !(m_unOptions&unDELAY_CLOSE) )
SetTimeout(m_unTimeout); // start close timer
}
You should remove the !, I think. Smile


GeneralRe: Bugfix
Shog9
5:43 13 Sep '07  
Joergen Sigvardsson wrote:
If I interpret your header file correctly, the balloon should close itself after a delay

Not quite - you can always specify a timeout after which the balloon will close; unDELAY_CLOSE changes the meaning of this timeout such that it doesn't start when the balloon is shown, but waits until some other action occurs.


every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- Chris Losinger, Online Poker Players?

Questionother Icons
Tieter
1:59 11 Sep '07  
Hello,

againt my cpmliment to this great work!
Does anybody know how to use my own icons in the balloon?
In the comment of tze code I found the following:

// szIcon | One of:
// IDI_APPLICATION
// IDI_INFORMATION IDI_ASTERISK (same)
// IDI_ERROR IDI_HAND (same)
// IDI_EXCLAMATION IDI_WARNING (same)
// IDI_QUESTION
// IDI_WINLOGO
// NULL (no icon)
// unIconID | ID of icon to display (loaded from resources)

I do not know how to handle the unIconID.

Thank you for your help
GeneralGreat, Thanks, and a couple of wrapers
Dan Bloomquist
14:55 10 Sep '07  

I think it great that I could just include your cpp and go. (vc7.1) Here are a couple of wrappers I added to hide the class where I will use it.

void ShowBalloonHelp( LPCTSTR strTittle, LPCTSTR strContent, HWND hControl )
{
     WINDOWINFO info;
     ::GetWindowInfo( hControl, &info );
     CRect rect( info.rcClient );
     CBalloonHelp::LaunchBalloon( strTittle, strContent, rect.BottomRight( ), IDI_ERROR,
          CBalloonHelp::unCLOSE_ON_KEYPRESS | CBalloonHelp::unDELAY_CLOSE, NULL, "", 3000 );  
}

void ShowBalloonHelpEdit( LPCTSTR strTittle, LPCTSTR strContent, CEdit& cEdit )
{
     ASSERT( DYNAMIC_DOWNCAST( CEdit, &cEdit ) );
     ShowBalloonHelp( strTittle, strContent, cEdit );
     ::SetFocus( cEdit );
     cEdit.SetSel( 0, -1 );
}

And the use becomes:
...
     cAdjust.GetWindowText( t );
     if( _ttol( t ) < -120 || _ttol( t ) > 120 )
     {
          ShowBalloonHelpEdit(
               _T("Out of Range Entry")
               ,_T("Please enter an 'Adjustment' between -120 and 120")
               ,cAdjust
          );
          pDX->Fail( );
     }
...

It works great!
Thanks, Dan.

GeneralUnable to pop up balloon from tray icon - pls help
anuradhabhakta
8:38 28 Aug '07  
Hi,

I am trying to use CBalloonHelp::LaunchBalloon() from a tray icon, which is launched using CSystemTray (downloaded from code project).

The balloon is popped up from the tray icon but when I move the cursor over the displayed balloon, mouse changes to hour glass. I am neither able to click the mouse or exit the balloon pop up. I have to explicitly kill the exe to come out of it.

CBalloonHelp::LaunchBalloon("Well...", "\tWhat do you think? Is this good? Is this useful? Does it need a lot of work? Or is it a complete waste of time... Let me know your thoughts!\n\n\tClick this balloon to send me some feedback...",
ptIcon, IDI_QUESTION, CBalloonHelp::unSHOW_CLOSE_BUTTON|
CBalloonHelp::unSHOW_TOPMOST |
CBalloonHelp::unCLOSE_ON_LBUTTON_DOWN,
this , "", 10);
Please let me know what could be wrong.

Also, strangely, if I launch the balloon from the dialog box, which is obtained by right clicking my icon, the balloon pop up works perfectly fine. Looks like the window pointer that is passed to the LaunchBalloon is causing issue. Can someone let me know what could be wrong.

Thanks in advance,
Anu


AnuradhaBhakta
GeneralA fixed version
Daniel Cohen Gindi
1:14 16 Aug '07  
I have modified the code to not use the dumb Thunk tehcnique,
because it does not allow you to port to another CPU architecture
I have implemented another technique, so still every instance of the class can get its own hook procedure!
And I have made also some more improvements...

I have sent the code to the author, hopefully he will post it here...

-----
Daniel Cohen Gindi
danielgindi (at) gmail dot com

GeneralRe: A fixed version
Rusty at Aquaveo
8:15 12 May '09  
I have experienced the problem with the Thunk class because I want to use the balloons with 64-bit Vista.

Can we get this modified version?

Rusty

GeneralOnce again
Joergen Sigvardsson
23:49 14 Aug '07  
You are going to save me a bunch of time (and not just by using CPHog to post this message!) Smile


Generalsome problem under vs2005
roni_guan
0:54 28 Apr '07  
can't auto tranlate from const char[] to const CString

i have to chanage code follow:

BOOL Create(const CString& strTitle, // title of balloon
const CString& strContent, // content of balloon
const CPoint& ptAnchor, // anchor (tail position) of balloon
unsigned int unOptions, // options (see above)
CWnd* pParentWnd = NULL, // parent window (NULL == MFC main window)
const TCHAR* strURL = NULL, // URL to open (ShellExecute()) when clicked
unsigned int unTimeout = 0, // delay before closing automatically (milliseconds)
HICON hIcon = NULL); // icon to display

// Show a help balloon on screen.
static void LaunchBalloon(const CString& strTitle, const CString& strContent,
const CPoint& ptAnchor,
LPCTSTR szIcon = IDI_EXCLAMATION,
unsigned int unOptions = unSHOW_CLOSE_BUTTON,
CWnd* pParentWnd = NULL,
const TCHAR* strURL = NULL,
unsigned int unTimeout = 10000);
QuestionHow To Destroy The ToolTip Explicitly
rupesh11
3:59 24 Apr '07  
I Wanted To Have Explicit Destroying Functionality For Tooltip.

I have Tried But I am getting Error Of Handle Of ToolTip is NULL.

Please Reply Quickly......

rahulwani.

AnswerRe: How To Destroy The ToolTip Explicitly
Shog9
6:39 24 Apr '07  
If you explicitly Create() it, you'll have a handle you can explicitly Close() or Destroy().



----
It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.
--Raymond Chen on MSDN

QuestionI am Geetting Error....
rupesh11
20:27 20 Apr '07  
c:\program files\microsoft visual studio\vc98\atl\include\atlwin.h(66) : error C2065: '_Module' : undeclared identifier
c:\program files\microsoft visual studio\vc98\atl\include\atlwin.h(2913) : error C2228: left of '.GetModuleInstance' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\atl\include\atlwin.h(2975) : error C2228: left of '.GetModuleInstance' must have class/struct/union type
f:\balloontooltip\balloonhelp.h(42) : fatal error C1189: #error : BalloonHelp.H requires atlmisc.h to be included first

Can U Help me.

rahulwani.

AnswerRe: I am Geetting Error....
Shog9
7:47 21 Apr '07  
Are you... using the WTL version?! It's really not gonna work in a normal MFC app...



----
It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.
--Raymond Chen on MSDN

QuestionHow Would I Use this class in MDI Application Of MFC
rupesh11
19:32 20 Apr '07  
How I proceed to add these class & how to use it ?
Please Reply Quickly.;)

rahulwani.

AnswerRe: How Would I Use this class in MDI Application Of MFC
Shog9
20:10 20 Apr '07  
See here:
http://www.codeproject.com/miscctrl/balloonhelp.asp#Using[^]



----
It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.
--Raymond Chen on MSDN


Last Updated 8 Aug 2002 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010