MSN Messenger like Tray Balloon

This simple class CTBalloon which is derived from CWnd can be used to show the tray balloon similiar to the one that appears with MSN messenger. I have used the CGradiant class which appeard in the artile Enhanced ProgressBar Control v1.1 by Yury Goltsman.

The following snippet shows how easy it is to use the class and incorporate it into your applications.


CTBalloon * pballoon = new CTBalloon(150,100);
pballoon->SetText(“Hello World – This is a sample message”);
pballoon->SetLifeTime(4);
pballoon->CreateAndShow();

The following are the various functions of the class.

CTBalloon(UINT nWidth, UINT nHeight) : Constructor, nWidth and nHeight are the dimensions of the balloon window.
void SetText(CString str) : Sets the text that will be shown on the balloon window
void SetLifeTime(UINT secs) : Sets the life time in seconds of the window.
BOOL CreateAndShow() : Creates the window and shows the animated balloon window. The window will be destroyed by itself.

Please let me know of any problems or improvements. Thanks and good luck.

Downloads

Download – 25 Kb

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read