Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

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.

  • *Gurus*
Posted (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 by PlausiblyDamp

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

  • *Gurus*
Posted
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.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

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?

UCM

>-)

Posted

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?

UCM

>-)

Posted (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 by PlausiblyDamp
Fat kids are harder to kidnap
Posted

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 *

UCM

>-)

  • 1 year later...
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...