-
July 9th, 2010, 12:33 AM
#1
Tray Notification Box
Hi. Does anyone know how to make tray notifications similar to AIM and Skype? It's not really a popup menu or balloon tip, but a little rectangle that pops up near the tray to say when someone has signed on/off/etc.
-
July 9th, 2010, 07:28 AM
#2
Re: Tray Notification Box
-
July 9th, 2010, 07:53 AM
#3
Re: Tray Notification Box
CreateWindow() ?
-
July 9th, 2010, 01:58 PM
#4
Re: Tray Notification Box
-
July 9th, 2010, 03:50 PM
#5
Re: Tray Notification Box
Hmmm. In the example, he can pop up as many windows as he wants. But, I can only pop up one before each other attempt causes a fault. I traced it to his line of
Code:
const char * p = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW);
ret = CreateEx(dwExStyle,p,NULL,dwStyle,rect,NULL,NULL);
Apparently, my application only lets that happen once, but every other time the register function fails. Only thing I can think of is his project properties put Use MFC in a Shared DLL, and mine just says Use Standard Windows Libraries.
Is there anything I can change that code to so it will work on my settings?
-
July 9th, 2010, 03:59 PM
#6
Re: Tray Notification Box
Nope, even when I tell my application to use mfc, still fails at that register line after 1 try. I don't get how his test application lets you show as many windows as possible. Something else must be different.
-
July 10th, 2010, 04:34 AM
#7
Re: Tray Notification Box
Try to register the window class just once in your application, at the beginning for example and then simple keep using that class name in subsequent create calls.
-
July 10th, 2010, 10:36 PM
#8
Re: Tray Notification Box
Thanks, Marc, it worked. Another question. For this box, it draws some text in the OnPaint() function. But, I decided it might be cool to have clickable text too. I found a static text class that makes the text clickable. But, I'm not sure how I add a static text object to my window. All this example has is an OnPaint() function which uses the CPaintDC DrawText() function. Do you know how I can tell it to "draw" a static text object?
My other idea was to just handle the left click event myself, but then I can't figure out how to detect which text was clicked on, so it would seem easier if I just reused this hyperlink static text class.
-
July 12th, 2010, 03:04 AM
#9
Re: Tray Notification Box
A static text control is also a window. Almost everything you see in Windows is actually a "window". So, to create this static text control, you call Create with classname "STATIC".
Your second idea is also possible. You can create an array which contains the rectangles of all your clickable text. When the user clicks somewhere in your window, you iterate over this array and see if the clicked point lies in a rectangle of some text and then you know which text you clicked.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|