Results 1 to 6 of 6

Thread: MSN like toast popup | Needz help |

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2008
    Posts
    128

    MSN like toast popup | Needz help |

    Hi,

    I am looking to make a msn like toast popup for my program!

    I have been working and searching for it all day now and cant find it!
    I did find this one:
    http://www.vbforums.com/showthread.php?t=320639

    But thats wayyyy to complicated

    I have been trying to edit it and strip it but theres just to much calling etc to really strip it to just one popup without all the options.

    I went coding myself and now have this:
    Code:
    Const ABM_GETTASKBARPOS = &H5
    Dim ok As Integer
    Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
    
    Private Type APPBARDATA
        cbSize As Long
        hwnd As Long
        uCallbackMessage As Long
        uEdge As Long
        rc As RECT
        lParam As Long
    End Type
    
    Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long
    
    Private Sub Form_Load()
    Timer1.Enabled = True
    Timer2.Enabled = False
    Timer3.Enabled = False
        Dim ABD As APPBARDATA
        
        SHAppBarMessage ABM_GETTASKBARPOS, ABD
        
        Me.Move ScaleX((CInt(Trim(ABD.rc.Right)) - ScaleX(Me.Width, 1, 3)), 3, 1), ScaleX((CInt(Trim(ABD.rc.Top)) - ScaleX(Me.Height, 1, 3)), 3, 1) + Me.Height
    ok = Me.Top
    End Sub
    
    Private Sub Timer1_Timer()
        Dim ABD As APPBARDATA
        
        SHAppBarMessage ABM_GETTASKBARPOS, ABD
    Dim Aimlength As Integer
    If Me.Top > ok - 345 Then
    Me.Top = Me.Top - 10
    End If
    If Me.Top < ok - 345 Then
    Timer1.Enabled = False
    Timer2.Enabled = True
    Timer3.Enabled = False
    End If
    End Sub
    
    Private Sub Timer2_Timer()
    Timer1.Enabled = False
    Timer2.Enabled = False
    Timer3.Enabled = True
    End Sub
    
    Private Sub Timer3_Timer()
        Dim ABD As APPBARDATA
        
        SHAppBarMessage ABM_GETTASKBARPOS, ABD
    Dim Aimlength As Integer
    If Me.Top < ok Then
    Me.Top = Me.Top + 10
    End If
    If Me.Top > ok Then
    Timer1.Enabled = False
    Timer2.Enabled = False
    Timer3.Enabled = False
    End If
    
    End Sub
    This DOES work pretty good but there's just one problem.
    It doesnt come ontop of all my other programs i have opened up
    Like internet etc

    When i went searching for a solution i found how to make a form stay ontop of all the others.
    i implented it. Worked..
    But all my forms of the program came on top! gah ><

    So when i was browsing arround the internet and the notification came on top.
    My main form came on top to.. this is not what i wanted to happen and i dont know how to fix it ;S

    Can someone please help?

    Thanks in advance

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: MSN like toast popup | Needz help |

    Have you had a look at the example in post #46 of that thread?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: MSN like toast popup | Needz help |

    Thread moved from the 'CodeBank VB6' forum (which is for you to post working code examples, not questions) to the 'VB6 and earlier' forum

    (thanks for letting us know Nightwalker83 )

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: MSN like toast popup | Needz help |

    Here is a really basic one. It uses the SysInfo control to get the proper WorkArea dimensions but you could replace this with API calls.

    It handles the "on top" requirement I think. It also queues requests and shows them serially instead of doing any fancy "stacking" of toast windows. Push the "Request PopUp" button multiple times to see this.

    You could do a lot to pretty this up. I ended up going with a borderless Form here because under Aero (Vista or later) the Width and Height of a fixed size Form are unreliable, due to extra border padding the VB6 program doesn't "see."

    I don't claim elegance, but it should be easy to use.
    Attached Files Attached Files
    Last edited by dilettante; Apr 3rd, 2010 at 05:24 PM. Reason: Minor change

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2008
    Posts
    128

    Re: MSN like toast popup | Needz help |

    Quote Originally Posted by dilettante View Post
    Here is a really basic one. It uses the SysInfo control to get the proper WorkArea dimensions but you could replace this with API calls.

    It handles the "on top" requirement I think. It also queues requests and shows them serially instead of doing any fancy "stacking" of toast windows. Push the "Request PopUp" button multiple times to see this.

    You could do a lot to pretty this up. I ended up going with a borderless Form here because under Aero (Vista or later) the Width and Height of a fixed size Form are unreliable, due to extra border padding the VB6 program doesn't "see."

    I don't claim elegance, but it should be easy to use.
    Wow thats great! : D
    Just downloaded it and reading through the source.
    Just noticed that when im not focused on the program but on something else
    Popups overlap the taskbar .. ;(

    Hope i can fix it! ( or you :P coz i dont really know how its made )
    Thanks for the source!

    And looking how i can stack them.
    Thanks again!

  6. #6
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: MSN like toast popup | Needz help |

    I'm not sure why the toast popups would overlap the taskbar. That doesn't happen here.

    I made a small change that requires another API call to find the Taskbar hWnd and arrange the toast Form just beind that instead of "on top." Maybe that will fix it.

    If you want stacking things get more complicated.

    If the existing code is hard to understand then you might be better off using the CodeBank version. Sometimes you just have to use the provided code without looking at it or changing it. You'd have a heart attack if you looked at what goes on in something like a RichTextBox or even a TextBox.

    Doing toast popups properly gets very involved. Coordinating Toast Pop-ups Between Multiple Clients discusses just one of the issues.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width