-
Dec 28th, 2005, 06:28 PM
#1
Thread Starter
Frenzied Member
popup message on bottom right of screen
im not sure how to explian this but here is an e.g..
Msn messenger, when someone signs in you see a box popup bottom right of the screen showing 'user has signed in' etc
i want a simple popup like this to appear in the bottom right screen for 2 seconds, any one know how to do this guys?
or an alternative is something which appears on top of everything like a msgbox? but i dont know if this is possible
-
Dec 28th, 2005, 06:34 PM
#2
Re: popup message on bottom right of screen
Create a form with all the options you want, then make it always on top.
-
Dec 28th, 2005, 06:35 PM
#3
Re: popup message on bottom right of screen
There is a good example project in the CodeBank forum by wokawidget. Its in Badger Messenger and MSN Clone projects by him.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Dec 28th, 2005, 06:36 PM
#4
Re: popup message on bottom right of screen
To make a window on top
VB Code:
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Sub Form_Activate()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
'E-Mail: [email]KPDTeam@Allapi.net[/email]
'Set the window position to topmost
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub
-
Dec 28th, 2005, 07:04 PM
#5
Thread Starter
Frenzied Member
Re: popup message on bottom right of screen
hey andrew thanks, so lets say a user has 20 applications open, that form wil appear on the screen infront of them, when activated?
-
Dec 28th, 2005, 07:05 PM
#6
Re: popup message on bottom right of screen
Just put this together, so all you need to do is change the timers interval for different speeds. Should give you an idea as to how to do it.
VB Code:
Private Sub Form_Load()
Me.Move Screen.Width - Me.Width, Screen.Height
End Sub
Private Sub Timer1_Timer()
Me.Top = Me.Top - i
' 9000
i = i + 30
If Me.Top < Screen.Height - Me.Height Then
Timer1.Enabled = False
End If
End Sub
-
Dec 28th, 2005, 07:12 PM
#7
Thread Starter
Frenzied Member
Re: popup message on bottom right of screen
thanks jmac, but when i ran that i didnt see nothing
-
Dec 28th, 2005, 07:14 PM
#8
Re: popup message on bottom right of screen
Originally Posted by Pouncer
hey andrew thanks, so lets say a user has 20 applications open, that form wil appear on the screen infront of them, when activated?
yes
And just adding ontop of Jmacp's code, if you want to get the startbar height use
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
'-------------------------------------
Dim R As RECT
tWnd = FindWindow("Shell_TrayWnd", vbNullString)
GetWindowRect tWnd, R
Then use (R.Bottom - R.Top)
-
Dec 28th, 2005, 07:15 PM
#9
Re: popup message on bottom right of screen
Originally Posted by Pouncer
thanks jmac, but when i ran that i didnt see nothing
Did you put a timer on the form ? If not set its interval to say 1.
-
Dec 28th, 2005, 07:17 PM
#10
Thread Starter
Frenzied Member
Re: popup message on bottom right of screen
yep, i ran it, and nothing happens,
what should happen?
when i click on the form1 fromt the taskbar, i get an error on line
Me.Top = Me.Top - i
saying the form cant be moved or sized while minimized/maximised
-
Dec 28th, 2005, 07:18 PM
#11
Re: popup message on bottom right of screen
for jmac's code to work, put a in the declarations of the form
-
Dec 28th, 2005, 07:21 PM
#12
Thread Starter
Frenzied Member
Re: popup message on bottom right of screen
ahhh yes, thats exactly what im looking for, thanksss!!!
and what about closing the form after 5 seconds?
-
Dec 28th, 2005, 07:24 PM
#13
Thread Starter
Frenzied Member
Re: popup message on bottom right of screen
hey andrew about the
R.Bottom - R.Top
where can i put that mate?
because i increaed by taskbar height to double and form gets cut of in the bottom right
-
Dec 28th, 2005, 07:29 PM
#14
Re: popup message on bottom right of screen
I just changed Jmacp's a bit (i hope you don't mind) so now it rises up and after 5 sec it drops down and unloads.
You'll need 2 timers
VB Code:
Dim i As Long
Dim dir As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Sub Form_Load()
Me.Move Screen.Width - Me.Width, Screen.Height
dir = -1
Timer1.Interval = (1000 / 16)
Timer2.Interval = 5000
Timer2.Enabled = False
End Sub
Private Sub Timer1_Timer()
On Error Resume Next 'In case you minize the form
Dim R As RECT
tWnd = FindWindow("Shell_TrayWnd", vbNullString)
GetWindowRect tWnd, R
Me.Top = Me.Top + (i * dir)
' 9000
i = i + 30
If Me.Top < Screen.Height - Me.Height - (R.Bottom - R.Top) Then
Timer1.Enabled = False
Timer2.Enabled = True
ElseIf Me.Top > Screen.Height Then
Unload Me
End If
End Sub
Private Sub Timer2_Timer()
dir = 1
Timer1.Enabled = True
Timer2.Enabled = False
End Sub
Last edited by Andrew G; Dec 28th, 2005 at 07:48 PM.
-
Dec 28th, 2005, 07:34 PM
#15
Thread Starter
Frenzied Member
Re: popup message on bottom right of screen
andrew exactly what im looking for, very nice
i tested your code but when i increase my taskbar height, the form cuts off
-
Dec 28th, 2005, 07:39 PM
#16
-
Dec 28th, 2005, 07:48 PM
#17
Re: popup message on bottom right of screen
I edited my above post to fix the problem
-
Dec 28th, 2005, 08:22 PM
#18
Thread Starter
Frenzied Member
Re: popup message on bottom right of screen
thanks andrew but any idea why it doesnt work when my program is in the system tray
-
Dec 28th, 2005, 08:28 PM
#19
Re: popup message on bottom right of screen
I have no idea, when i noramally use it i have the main program, the popup menu form and a form especially made for the system tray, so everything is seperate.
-
Dec 29th, 2005, 07:14 AM
#20
Thread Starter
Frenzied Member
Re: popup message on bottom right of screen
ok no problem thanks for your help, by the way
if i call this form from another form multiple times would it give errors?
-
Dec 29th, 2005, 07:16 AM
#21
Re: popup message on bottom right of screen
Originally Posted by Pouncer
ok no problem thanks for your help, by the way
if i call this form from another form multiple times would it give errors?
Probably not, but you would have to test that to be sure.
To be perfectly safe, if it isn't in use, then I would unload it.
-
Dec 29th, 2005, 01:50 PM
#22
Addicted Member
Re: popup message on bottom right of screen
at first Thanks for all Supporters in this UseFul Forum.
I have already started search for this Method and i tried it ti works well with me also when the program is in the system tray.
-------------
But the Form doesnt appear in the same Position if it will apear more than one time
By the way at first Run i got un error with this:
tWnd = FindWindow("Shell_TrayWnd", vbNullString) .. Error is tWnd is not define
so i just tried to declare it as String, single and long
i got the same result the window doesnt move to the same position
,,,
Last edited by _Conan_; Dec 29th, 2005 at 02:06 PM.
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
|