-
1 Attachment(s)
MSN Messenger Style Systray Notification Messages
UPDATED 10th March 2005
I have developed a fully functional, fully customisable MSN Messenger Style systray notification system.
Features:
- Multiple popup messages
- Scrolling direction, Up, Down, Left or Rigth
- Sticky Messages
- Display inside app or picbox by setting parent to containers hWnd
- Click message to hide it
- Message in front of all other windows
- Smooth scrolling
- Custom background picture
- Custom Logo
- Custom Message
- Custom Caption
- Custom Size
- Play different sounds when showing message
- Add progress bar to message (like Norton Anti Virus when it scans emails)
- If no room is available to display message then it waits till another message hides 1st.
- Change show time, scroll speed and movement increment.
- Allow clickable messages which raise an event back to the UI.
- Simple to use DLL. Easy to add functionality to any project.
- Main app now keeps focus (Thanks to 86atc250r for the code)
- Messages now able fade in and out
- NEW: Detachable messages. Drag a message as a sticky desktop note.
Download the project and run Test.vpg.
Any comments most welcome.
Woka
-
Re: Systray Notification Messages
woka, very nice code. I have 2 suggestions for you...
get a new hand icon for the mouseover on links... that thing looks like you pulled it from windows 3.11
also, if the user has the mouse over the form region, you should set a flag to make the window drop, but not drop it until the mouse leaves the form region of the popup.. know what im saying.. likewise if the popup is scrolling off, and they mouse over.. it should return to its original state...
-
Re: Systray Notification Messages
Quote:
Originally Posted by kleinma
woka, very nice code. I have 2 suggestions for you...
get a new hand icon for the mouseover on links... that thing looks like you pulled it from windows 3.11
also, if the user has the mouse over the form region, you should set a flag to make the window drop, but not drop it until the mouse leaves the form region of the popup.. know what im saying.. likewise if the popup is scrolling off, and they mouse over.. it should return to its original state...
Hmm seems like messenger, what purpose does this serve, reinventing the wheel ?
-
1 Attachment(s)
Re: Systray Notification Messages
here is a better cursor.. give it a try
-
Re: Systray Notification Messages
Quote:
Originally Posted by jhermiz
Hmm seems like messenger, what purpose does this serve, reinventing the wheel ?
I don't follow you?
-
Re: Systray Notification Messages
Quote:
Originally Posted by jhermiz
Hmm seems like messenger, what purpose does this serve, reinventing the wheel ?
Hahahaha...yes...exactly like messenger :rolleyes: You gibbering yanky doodle dandy :wave:
All the code does is popup application notifications...like messenger, but that's all it has in common with messenger.
It's a dll that you can add to any app that allows you to easily add notification messages. Very handy, and personally I think it's quite cool too, espescially the messages with a prog bar :D
So...reinventing the wheel...I don't think so ;)
-
Re: Systray Notification Messages
Quote:
Originally Posted by Wokawidget
Hahahaha...yes...exactly like messenger :rolleyes: You gibbering yanky doodle dandy :wave:
All the code does is popup application notifications...like messenger, but that's all it has in common with messenger.
It's a dll that you can add to any app that allows you to easily add notification messages. Very handy, and personally I think it's quite cool too, espescially the messages with a prog bar :D
So...reinventing the wheel...I don't think so ;)
But their are tools which do this, are you saying you need a reminder from what ??? From a task that you are assigned ? Theres tools fully integrated that do that, still cool to write the code though.
-
Re: Systray Notification Messages
no i see how this could be useful on any number of apps to give you notification when a job is done or other progress... doesnt have to be just a messenger type of thing
I wrote an app that COULD use this if I had not already implemented balloon tips instead.. just a little too late woka
-
Re: Systray Notification Messages
Quote:
Originally Posted by kleinma
no i see how this could be useful on any number of apps to give you notification when a job is done or other progress... doesnt have to be just a messenger type of thing
I wrote an app that COULD use this if I had not already implemented balloon tips instead.. just a little too late woka
Give me some examples of how this could be used ?
Updating a db isnt a good one either, how do I run it from a sproc :).
And Im not going to use xp_cmdshell to run an exe to tell me an update is done.
BTW a windows scheduled task is not a good example. Give me a good example of why I would put this to use ?
-
Re: Systray Notification Messages
I have an application I wrote that interfaces with our CD duplicator... when a job is done a balloon tip pops up to let the user know the CD has finished burning and printing.. or if it fails it pops up saying that and the fail reason.. I could use this code instead of balloon tips if I wanted to, to give notification of progress to users...
-
Re: Systray Notification Messages
I guess it depends on your needs.
-
Re: Systray Notification Messages
doesn't any piece of code?
-
Re: Systray Notification Messages
Anyone know if C# can register this type of dll ?
-
Re: Systray Notification Messages
register or use? if its registered on the system via com, then you should be able to add a reference to it under the com tab in references...
-
Re: Systray Notification Messages
Quote:
Originally Posted by kleinma
register or use? if its registered on the system via com, then you should be able to add a reference to it under the com tab in references...
I suspect if its a COM somehow it could be instantiated and called.
I know with something like vb6 to dotNet not a biggie, one can just reference it and dim the object.
But what about in this case...can I do:
ObjWoka objW = new objW("Place this text");
objW.Show();
?
I'd assume he would have to make this some sort of native call from C# to this vb app ? Is that even possible ?
-
Re: Systray Notification Messages
You couldn't do:
Code:
objWoka objW = New objW("Place this text");
As my DLL was written in VB6, and this doesn't support:
Code:
New objW("Place this text")
You would have to use:
Code:
objWoka objW = New objW;
objW.Caption = "MSN Messenger"
objW.Message = "jHermiz has just signed in. Run Away!"
objMessages.Show objW
Download the project and check it out. It will take a mere 30 seconds to test the app, then a further 10 seconds to compile the DLL.
Woka
-
Re: Systray Notification Messages
woka you should really port this code over to .net and make it a .net dll
-
Re: Systray Notification Messages
One step at a time Batman :D
Hahaha...am finishing work on some async downloading code.
Then have some work to do on my LiveUpdate app.
Then I will start converting the apps in my sig to .NET
To be fair, this message notification DLL shouldn't be too hard at all to convert. The code for it is relatively easy.
You wanna try converting this app. Intregued to see how you would do it :D
Woka
-
Re: Systray Notification Messages
New version.
Download attachment from 1st post.
New features include setting parent to be a picture box, or form.
Ability to have sticky messages
Click message to hide
Message in front of all other windows
Set x,y pos to be anywhere.
New Demo UI.
Let me know what you think.
DemoUI code could be a little better, will tidy this up laters, but this code is only to demo the DLL functions, so it isn't that important.
Woka
-
Re: Systray Notification Messages
New version.
Download from 1st post.
Have added the ability to scroll in any direction, not just up.
Messages can now scrool up, down left or right.
Woka
-
Re: MSN Messenger Style Systray Notification Messages
Well you are welcome for the extra functions I told you too add....;)
Very nice indeed. You are realy starting to be usefull around here. If you just knew a bit more about 3D programming you could soon start to call your self my friend.
No seriously. This test app shows everything you realy want a pop up to do. Realy good. Love it.
ØØ
-
Re: MSN Messenger Style Systray Notification Messages
Nice app. You have added some things that I had not thought of. I have created one as well but yours is much better.
-
Re: MSN Messenger Style Systray Notification Messages
Thank you :D
If you have any questions on the code then let me know.
This app was designed to work with my systray icon code and my LiveUpdate auto updater software, both of which are in my sig.
Woka
-
Re: MSN Messenger Style Systray Notification Messages
wow, thats really good!
was it hard to make?
-
Re: MSN Messenger Style Systray Notification Messages
Depends on what you class as hard.
There isn't much complex coding, but it's just about the design of the code and fitting components together. That's the hardest bit.
I would say it's an avaergae to hard project.
Now my multithreading code was hard :D
Woka
-
Re: MSN Messenger Style Systray Notification Messages
Nice code, thanks for sharing!
One think I'd really like to see in code like this is for the notification not to steal focus from the app I'm currently working in when the notification displays.
How difficult would that be to implement? I'm looking into it now & if I figure it out, I'll post.
-
Re: MSN Messenger Style Systray Notification Messages
Edited....
Woo Hoo! I figured it out...
Here's the code:
In the PopUpMessage class module's "general" section add the following code under the Option Explicit statement:
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_SHOWNOACTIVATE = 4
Next, go down to the "Friend Sub MoveMessage" section and replace the .show statement with:
ShowWindow hWnd, SW_SHOWNOACTIVATE
Problem Solved!
-
Re: MSN Messenger Style Systray Notification Messages
Quote:
Originally Posted by Wokawidget
Depends on what you class as hard.
Now my multithreading code was hard :D
Woka
I swear woka you are going to marry that multithreading code one of these days.... :bigyello: :bigyello:
its too bad .net made it all to easy to multithread ;)
-
Re: MSN Messenger Style Systray Notification Messages
Quote:
Originally Posted by 86atc250r
Edited....
Woo Hoo! I figured it out...
Here's the code:
In the PopUpMessage class module's "general" section add the following code under the Option Explicit statement:
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_SHOWNOACTIVATE = 4
Next, go down to the "Friend Sub MoveMessage" section and replace the .show statement with:
ShowWindow hWnd, SW_SHOWNOACTIVATE
Problem Solved!
Top notch :D Good idea. Will add that functionality to my code.
Cheers again :wave:
Klienma...you're just jealous ;)
-
Re: MSN Messenger Style Systray Notification Messages
Next thing - how difficult would it be, or what would be the best way to go about making the text in the message autowrap or make the message autosize to a point, then wrap?
I'll look into that too if no one else figures it out before I do.
-
Re: MSN Messenger Style Systray Notification Messages
I agree. That's something I have planned.
The functionality regarding the UI of the message is a bit lacking.
It does what 99% of users would use it for, but I myself require a different UI style to the one of the moment.
I am currently working on some enhancements for the UI.
My time has been taken up recently my the development and improvement of my liveupdate code.
My aim to to create a fully functional autoupdater with systray icon if it's running silently in the background, and popup messages to alert you to how the updates went, again in silent mode.
If you take a peek at my liveupdate link in my sig you will see what I mean.
I have all the components written and it's a matter of a few hours coding to link them all up and do some restructuring of the code in LiveUpdate.
Oh, the liveupdate in my sig is an old version. I have been working on a new version for the last 2 weeks. Should be finished in a few days, if not tomorrow.
Woka
-
Re: MSN Messenger Style Systray Notification Messages
Quote:
Originally Posted by 86atc250r
Next thing - how difficult would it be, or what would be the best way to go about making the text in the message autowrap or make the message autosize to a point, then wrap?
I'll look into that too if no one else figures it out before I do.
Just re-read ya post. I am not sure what you are referring to :(
Making the message box autosize is possible, but all the messages would be different sizes, and I think this would look sloppy. You can set the size of the message box using the properties of the Messages class.
As for wrapping...errr...the label wraps the text...:confused:
One thing it does require is to work out the height of the label, and trim the text so it fits in the message, adding "..." to the end of it. Does that make sense?
Woka
-
1 Attachment(s)
Re: MSN Messenger Style Systray Notification Messages
That all makes sense, but for some reason the text is not wrapping for me - for instance, I've got a media player application I'm using this code with. When I feed the message with artist and song title (when a song changes), neither will wrap if too long. The text will extend to the edges of the pop up & the rest will be cropped.
Maybe I'm doing something wrong or overlooking something? Below is an example:
-
Re: MSN Messenger Style Systray Notification Messages
I think I've got this one whipped as well.
Go into the code of the frmPopUpMessage form and find the Public Sub ResizeControls
Under that sub find:
VB Code:
With lblMessage
.Left = (shpBorder.Width - .Width) / 2 + shpBorder.Left
.Top = (shpBorder.Height - IIf(prgBar.Tag = True, prgBar.Height + (2 * ICON_GAP), 0) - .Height) / 2 + shpBorder.Top
End With
And change it to:
VB Code:
With lblMessage
.wordwrap = true
.Width = shpBorder.Width - 100
.Left = (shpBorder.Width - .Width) / 2 + shpBorder.Left
.Top = (shpBorder.Height - IIf(prgBar.Tag = True, prgBar.Height + (2 * ICON_GAP), 0) - .Height) / 2 + shpBorder.Top
End With
-
Re: MSN Messenger Style Systray Notification Messages
Just posted a new version. This allows the message to fade in and out.
Only works on Win 2000 and above.
Tried ya message label code, it didn't work for me.
Will address this issue tomorrow.
Zzzzzzz
WOka
-
Re: MSN Messenger Style Systray Notification Messages
How would I use the popup after compiling a DLL for it from the vbg?
-
Re: MSN Messenger Style Systray Notification Messages
Exactly like you would in the DemoUI application...:confused:
What you need to do is, 1st of all, close down the app.
Then open up the vbAPITimer DLL, and compile that.
Close the VB IDE
Now open up the vbPopUpMessage vb app.
Reference the vbAPITimers.dll, this can be done viw Project--->References then select vbAPITimer.
Now compile the vbPopUpMessage app.
Close the IDE down.
Open up the DemoUI project.
Project--->References--->vbPopUpMessages
Now run the project.
Hope that helps.
Woka
-
Re: MSN Messenger Style Systray Notification Messages
Awesome widget!
Here's my two cents....
1) Add a mobjPopus.WordWrap boolean property; the current version just runs a long string off the edges of the popup.
2) When you change mobjPopups.MessageWidth, lblMessage in the pupup class apparently does not adjust to match the newly assigned width of the pop up. Obviously it would be good if it autosized with the rest of the popup.
Nice work! I'd love to incorporate this gadget in an app I'm working on now. Any chance of a rework any time soon?!
Bob
-
Re: MSN Messenger Style Systray Notification Messages
I'll have a look tonight...or you could do the changes your self :D
Only requires some resize code for the label.
Woka
-
Re: MSN Messenger Style Systray Notification Messages
OK, I'll make you a deal. I made the changes to resize the label. How about if you fix the part that will keep adjust the top and left properties of the popup so that it will always be aligned with the corner of the screen if you change the message width or height properties (depending on which direction you are popping from.) For example, if you increase the width with PopUpDirection set to vbPopUp, then the right side of the popup is off screen. Simply setting the xpos and ypos isn't a good option because it would not compensate for variable screen resolutions.
Deal?! :thumb:
Here's the change I added to frmPopUpMessage.ResizeControls to ensure that the label is properly resized. I also set the WordWrap proper to of the label to TRUE.
Public Sub ResizeControls(ByVal plngMsgHeight As Long, ByVal plngMsgWidth As Long)
...
With lblMessage
.Top = shpBorder.Top + 100
.Left = shpBorder.Left + 100
.Width = shpBorder.Width - 200
.Height = shpBorder.Height - 200
End With
...
End Sub
-
Re: MSN Messenger Style Systray Notification Messages
I thought word wrap was On. D'oh. Cheers :D
Changing the message width would make it look funny if you've alligned it to the far corner.
I have thought about this ages ago and decided not to add this in for the following reasons:
- An app should only use 1 sized message for consistancy
- I believe this code should live in the UI and not the Message dll
Does that make sesne?
Hmmm however...on second thoughts...I could add an allign property in.
Howvere I don't have time to do this at the mo as I am working on about 5 different projects at the same time and it's messing with my head. I have decided to give it a rest for a week and reclaim back my social life :D
Keep coming up with the good suggestions :D
I am about to add this into my MSN Messenger app (see link in sig) so that I can have popups like messenger for my own messenger (BTW it uses the MSN network ;))
Woka
-
Re: MSN Messenger Style Systray Notification Messages
Hi,
Could it be made into a User Control ? ( .ctl )
No VBG, no OCX, no DLL
-
Re: MSN Messenger Style Systray Notification Messages
errrr.yea.
Well I wouldn't make it into an OCX because it could be used by a DLL, and you cant use an OCX in a DLL except if you use a form (bad)
What you can do is add ALL the module, classes and forms into your normal project and it will still work.
To be fair, it's best being a DLL since more than one app can then use this.
Woka
-
Re: MSN Messenger Style Systray Notification Messages
This is a very nice tool but I'm having one problem. I don't know if there is a fix for this but I figured I'll ask. I got it all integrated into my application and it works perfectly - when running from the IDE.
However when I run the compiled app I run into an issue. In my compiled app I want to use this to notify users when they have received an email on our internal application email system. It works great except that there is a very high likelihood that they will be using a modal form when they get this notification.
The app works just as I want when running from the IDE but I get "Run-time error '402'" when running the compiled version. Is there anything I can do to make this work?
-- Dave
-
Re: MSN Messenger Style Systray Notification Messages
Dear Sir,
Thanks for providing a good tool.
i require this tool to be integrated in an application
Whenever the employee leave application has been sanctioned by his boss, He needs to informed like this. For this How to go about.
Please explain
Thanking you
yours
Karthikeyan R
-
1 Attachment(s)
Re: MSN Messenger Style Systray Notification Messages
Here's a very very simple demo...
Woka
-
Re: MSN Messenger Style Systray Notification Messages
Is there a way of resizing the actual popup, aligning all the controls, as manually resizing it in VB makes no difference...
Excellent dll by the way....... shame we need the apitimer.dll included in our package too
-
Re: MSN Messenger Style Systray Notification Messages
if you don't want vbAPITimer.dll in your package then just take the module, and class from vbAPITimer and add them to the project you want them to be in.
The reason this is a DLL is because loads of my projects use this timing component, and it just made sense to sperate it out into it's own DLL. I am fussy like that :D
You can make the popup fixed. But I wanted the developer to pick the size of the message box. Bearing in mind that a few of my apps use this, and they don't want the same message sizes as some info I display is much bigger.
You can change the height and widht of the popup by using the MessageWidht and Height properties of PopupMessages Class. Is this what you wanted?
Woof
-
Re: MSN Messenger Style Systray Notification Messages
Quote:
Originally Posted by Wokawidget
if you don't want vbAPITimer.dll in your package then just take the module, and class from vbAPITimer and add them to the project you want them to be in.
Ok, I'll do that... Thanks. :thumb:
Quote:
Originally Posted by Wokawidget
You can change the height and widht of the popup by using the MessageWidht and Height properties of PopupMessages Class. Is this what you wanted?
Yes, sorry, I should take more notice of the code more....... :rolleyes:
-
Re: MSN Messenger Style Systray Notification Messages
I'm a newbie so please don't flame if this is a really dumb question...
I compiled the projects into dll's and am calling them within my vb .net program successfully using the code below:
VB Code:
Dim objMsg As New vbPopUpMessages.PopUpMessage
Dim objMsgs As New vbPopUpMessages.PopUpMessages
objMsg.Caption = "test"
objMsg.Message = "message"
objMsgs.Show(objMsg)
I would like to add a custom background and thought this line would do it:
VB Code:
objMsg.Background = PictureBox1
But I am getting this error:
An unhandled exception of type 'System.InvalidCastException' occurred in program.exe
Additional information: Specified cast is not valid.
Could someone help?
Added [vbcode][/vbcode] tags - Hack
-
Re: MSN Messenger Style Systray Notification Messages
Hmmm...it works in .NET, cool.
I am assuming it doesn't work because a .NET picturebox is not the same as a VB6 picture box :(
Not sure how you would do this. I'll ask some people at work.
WOka
-
Re: MSN Messenger Style Systray Notification Messages
Got it to work.
VB Code:
Dim objPic As New vbPopUpMessages.PopUpMessage
objPic.Caption = "Test"
Dim imgconv As ImageConverter
objPic.Background = imgconv.ImageToIPicDisp(picImage.Image)
objMsgs.Show(objPic)
Public Class ImageConverter
Inherits System.Windows.Forms.AxHost
Public Sub New(ByVal pGUID As String)
MyBase.New(pGUID)
End Sub
Public Shared Function ImageToIPicDisp(ByVal value As System.Drawing.Image) As stdole.IPictureDisp
Return System.Windows.Forms.AxHost.GetIPictureDispFromPicture(value)
End Function
Public Shared Function IPicDispToImage(ByVal value As stdole.IPictureDisp) As System.Drawing.Image
Return System.Windows.Forms.AxHost.GetPictureFromIPictureDisp(CType(value, Object))
End Function
End Class
Added [vbcode][/vbcode] tags - Hack
-
Re: MSN Messenger Style Systray Notification Messages
Quote:
Originally Posted by RobertMa
I'm a newbie so please don't flame if this is a really dumb question...
No one should ever be flaming anyone, so that is something you don't have to worry about (if it does happen, PM a Mod and let us handle it. :) )
Incidentially, as you can see, I've added [vbcode][/vbcode] tags for your two posts and request that you use them in future posts. As you can see, it makes posted code so very much easier to read. :thumb:
-
Re: Systray Notification Messages
Thanks Hack.
Quote:
Originally Posted by kleinma
here is a better cursor.. give it a try
How would I switch to this smaller cursor to see how it looks? I can't find a reference to the Hand.cur anywhere.
-
Re: MSN Messenger Style Systray Notification Messages
I've found that everything works very well, but I have run into a minor bug.
I've noticed that if you open a modal window while a notification window is open, the notification window timer is halted and the notification windows won't go away until the modal window is closed.. This should be fine, however, in my application I have a modal (preferences) window that can open another modal window. I've found that when the second modal window is closed, the notification windows must receive some kind of message that tells them a modal window closed, and they restart their timer and eventually try to close. However, my first modal window (preferences) is still open, and when a notification window closes while a modal window is open, you get the following error message:
---------------------------
vbPopUpMessages
---------------------------
Run-time error '402':
Must close or hide topmost modal form first
---------------------------
OK
---------------------------
I can also get the same error message to appear if I open a modal window while a notification is in the process of closing (while it's sliding back down).
It seems that the windows will not begin the closing operation (sliding back down) if a modal window is open, but it appears that it's the actual unloading of the window that cannot happen while a modal window is open.. Any suggestions on how to either prevent the notification window from unloading itself while a modal window is displayed, delay the unloading of the notification window until after the modal window is unloaded, or possibly unload the notification windows without the error message being displayed?
Thanks in advance!
-
Re: MSN Messenger Style Systray Notification Messages
Is this when running in the IDE or from compiled code?
WOka
-
Re: MSN Messenger Style Systray Notification Messages
Running compiled code causes the crash.
No crashes when running in IDE.. I'm guessing because there's probably some difference in how the IDE emulates the modal window..
-
Re: MSN Messenger Style Systray Notification Messages
Any new info or suggestions of the modal window error message?
For now I've worked around the issue by closing all current popups immediately prior to the modal window being shown, and disabling the creation of new popups while the modal window is visible.. But a cleaner solution would definitely be appreciated..
Thanks again!
-
Re: MSN Messenger Style Systray Notification Messages
nope noone what so ever. This code was written years ago in vb6. Alas, I have progressed and don't code in vb6 anymore. I very much doubt I will ever do anymore modifications to any of my vb6 projects. I do however, intend to write some .net versions...hopefully.
woof
-
Re: MSN Messenger Style Systray Notification Messages