'I trimmed off and rewrote almost all of this code.
'But my original inspiration goes to Robert Morris
'for his PopUp Balloons example. You can find it on planet source code
'by searching for "Popup Balloons (2k/XP-style)"
'
'Basically this determines the size and position of the form based on
'the text, and then turns the form into a rounded rectangle with a
'Balloon tip point (Yes I wrote that myself)
'Balloon tip position is based on where on the screen it will be displayed
'
'Sorry this is all the comments, they distract me when I'm programming.
Option Explicit
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type PointType
Point1 As POINTAPI
Point2 As POINTAPI
Point3 As POINTAPI
End Type
Private Type LOGBRUSH
lbStyle As Long
lbColor As Long
lbHatch As Long
End Type
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As PointType, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Declare Function FrameRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function 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) As Long
Private Declare Function CreateBrushIndirect Lib "gdi32" (lpLogBrush As LOGBRUSH) As Long
Private Const HWND_TOP = 0
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private bBottom As Boolean
Private bLeft As Boolean
Friend Sub ShowBalloon(sTitle As String, sText As String, X As Long, Y As Long, Optional IStyle As IconStyle, _
Optional iAutoCloseAfter As Integer = 0)
Dim lHeight&, lWidth&, lTop&, lLeft&
Me.BackColor = vbInfoBackground
lblTitle.ForeColor = vbInfoText
lblText.ForeColor = vbInfoText
lblTitle.Caption = sTitle
lblText.Caption = sText
If lblText.Width + 20 > ScaleX(Screen.Width / 2, vbTwips, vbPixels) Then