Winston Posted February 10, 2003 Posted February 10, 2003 hey guys i was wondering if its possible to achieve the little pop up window when use signs in to msn that little window at the bottom screen i wanna achieve that because im designing a task schedular program and would like to use that sort of effect to bring up reminders thanks guys Quote
*Experts* Volte Posted February 10, 2003 *Experts* Posted February 10, 2003 You will need to create a borderless form at the correct size you want and with the proper designs and whatnot on it, and then show it using the ShowWindow API in the corner of the screen. Use the following declaration for ShowWindow:Declare Function ShowWindow Lib "user32" (ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer Const SW_SHOWNA = 8 To show the alert window, use Dim alertWin As New frmAlert() 'frmAlert is your alert form ShowWindow(alertWin.Handle.ToInt32, SW_SHOWNA)You need to use the alertWin.Location property to move the form before the ShowWindow line. You can get the size of the screen by using the Screen.PrimaryScreen object. I believe the GetBounds method is what you need. Quote
Winston Posted February 11, 2003 Author Posted February 11, 2003 well to be quite honest im not quite experienced with vb.net so could u apply it inside an example for me pleasE? thanks Quote
*Gurus* divil Posted February 11, 2003 *Gurus* Posted February 11, 2003 (edited) Here's a quick example I knocked up for you. The program will bring up a form in the lower-right corner of the screen, above the taskbar, without taking the focus away from the current application. It uses the API that VolteFace suggested to do this. Note that the alert form must have its StartPosition set to Manual to be able to do this, and we use the Screen.WorkingArea property to get the bounds of the desktop excluding the taskbar. There is no animation in this sample.msnpopup.zip Edited March 16, 2007 by PlausiblyDamp Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Winston Posted February 11, 2003 Author Posted February 11, 2003 wow thanks man... but how do u make it so it slides up? instead of just appearing and stuff Quote
*Gurus* divil Posted February 11, 2003 *Gurus* Posted February 11, 2003 You'd probably start a timer in this case, and make the form larger and decrease its vertical position by the corresponding amount each time the timer fired. Obviously it would fire very quickly. Once the form is fully displayed, you stop the timer, and do a similar thing when it disappears too. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Winston Posted February 11, 2003 Author Posted February 11, 2003 how do u make it gradually increase in size Quote
UCM Posted February 12, 2003 Posted February 12, 2003 Try This >-) First off, Divil, your example rocks!!! and second: For this code modification of Divil's example to work like that, you need to do 4 things: 1st: add 3x timers to Divil's form1 ( names Timer1, Timer2, and Timer3 ) 2nd: shrink form2 to the minimum height ( for some reason, it won't shrink past 34 pixels, any idea why guys? ) 3rd: copy and paste the following code "As IS" in the form1's button1 control: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click alertWindow = New Form2() alertWindow.Location = New Point(Screen.PrimaryScreen.WorkingArea.Right - alertWindow.Width, Screen.PrimaryScreen.WorkingArea.Bottom - alertWindow.Height) 'UCM's CODE: Timer1.Enabled = True '/UCM's CODE: ShowWindow(alertWindow.Handle, SW_SHOWNOACTIVATE) Button2.Enabled = True Button1.Enabled = False End Sub and 4th: add the following code "As IS" to form1: Dim maximumHeight As Integer Dim mimimumHeight As Integer Dim displayMSGlifeTime As Integer Dim maximizingPixelRate As Integer Dim minimizingPixelRate As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Enabled = False Timer2.Enabled = False Timer1.Interval = 5 Timer2.Interval = 5 maximumHeight = 112 mimimumHeight = 34 displayMSGlifeTime = 3000 Timer3.Enabled = False Timer3.Interval = displayMSGlifeTime maximizingPixelRate = 4 minimizingPixelRate = 1 End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 'This timer is used to INcrease the size of the alert message... alertWindow.Height = alertWindow.Height + maximizingPixelRate alertWindow.Top = alertWindow.Top - maximizingPixelRate If alertWindow.Height >= maximumHeight Then Timer1.Enabled = False : Timer3.Enabled = True 'NOTE: the >= maximumHeight above is the maximum size of the alert window you would like... End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick 'This timer is used to DEcrease the size of the alert message... alertWindow.Height = alertWindow.Height - minimizingPixelRate alertWindow.Top = alertWindow.Top + minimizingPixelRate If alertWindow.Height <= mimimumHeight Then Timer2.Enabled = False : alertWindow.Close() : alertWindow.Dispose() 'NOTE: the <= mimimumHeight above is the maximum size of the alert window you would like... End Sub Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick 'This timer is used to wait a specific amount of time so that the form2's contents can be viewed by the user Timer3.Enabled = False Timer2.Enabled = True End Sub I probably couldd make this into a redistributible control with some effort ( If I get time in the coming weeks that is ) What do you all think? Quote UCM >-)
Winston Posted February 12, 2003 Author Posted February 12, 2003 hmm getting errors perhaps u could implement the code inside a solution and make a download if u dont mind Quote
UCM Posted February 12, 2003 Posted February 12, 2003 errs? what errs exactly? here's what I have, this is Divil's example with my modifications included....msnpopup-ucm-modified.zip Quote UCM >-)
UCM Posted February 12, 2003 Posted February 12, 2003 I just tried re-downloading Divil's example and go through my steps above and it worked fine... what error msg's are you getting? Quote UCM >-)
iebidan Posted February 12, 2003 Posted February 12, 2003 (edited) Well, I worked around a little bit in the code posted here, and made a component for this, added two features (text and background color) Now you can use this as a control in your project. If you add some more features to the control post it here, I'll keep working on my free time to add new features regards [edit]removed binaries - divil[/edit]alerter.zip Edited March 16, 2007 by PlausiblyDamp Quote Fat kids are harder to kidnap
Winston Posted February 13, 2003 Author Posted February 13, 2003 thank u to all of you .. i duno i now have such a vast selection to choose from the code u guys provide are so simple, the one someone sent me just now is impressive too do you guys think u can make the taskbar notifier into a control click here http://www.codeproject.com/useritems/TaskbarNotifier.asp Quote
UCM Posted February 13, 2003 Posted February 13, 2003 Got the minimum height from 34 prob figured out... Here's the thing, if you set the form2.formborderstyle to "sizable" then the absolute minimum the form can go is: " 136, 34 " ( probably larger on systems that use large fonts... But, if you set form2.formborderstyle to "sizabletoolwindow" then the absolute minimum size is: " 8, 8 " * new I should have checked that first * Quote UCM >-)
iebidan Posted February 13, 2003 Posted February 13, 2003 The code I posted is on aocntrol, still needs a lot of work, but the main idea is there Regards Quote Fat kids are harder to kidnap
Rosh Posted April 7, 2004 Posted April 7, 2004 In Your Boots, Hia's ur solution. Hello check out the following site, link, awesome stuff, just what u need! http://www.codeproject.org/cs/miscctrl/taskbarnotifier.asp Cheers Rosh :-) Quote
samsmithnz Posted July 21, 2004 Posted July 21, 2004 And to further this thread with more examples, Microsoft has released a .NET 'Powerpack' with this functionality built into a control. Check it out, theres some other good stuff in here too. http://msdn.microsoft.com/vbasic/default.aspx?pull=/library/en-us/dv_vstechart/html/vbpowerpack.asp Quote Thanks Sam http://www.samsmith.co.nz
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.