Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

General Info Tip

Does anyone know how to create the ballon style tooltips that appear when you receive the Windows 2000 Critical Notification or the Start Button the first time you use a 2000 installation?

It must work on any control type.

Thanks in advance
  • 3
  • 2
1 Solution
You cannot link to the installed Windows system other window styles, only other window resources ...

However, when you only want to create a ballon tooltip,
then you must create a top level window in the win32 sdk
subsystem and restrict the WindowRgn to a ballon polygon
or someone else.
Therefore you must create the toplevel window without any
border or system menues and create and destroy the window
by hand or at the responce of mouse events.

When you need help to create a toplevel window via
vb and restrict the windowrgn to a ballon  .. say it

AllannAuthor Commented:
do you have an example of your explanation?
Ok, here the little tricky code:


Begin VB.Form Form1
   BackColor       =   &H80000018&
   BorderStyle     =   0  'Kein
   Caption         =   "Form1"
   ClientHeight    =   2445
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   2445
   ScaleWidth      =   4680
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows-Standard
   Begin VB.Label TextToolTip
      BackColor       =   &H80000018&
      BackStyle       =   0  'Transparent
      Caption         =   "Text"
      Height          =   2175
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4335
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Declare Function CreateEllipticRgn Lib "gdi32" _
 (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, _
 ByVal Y2 As Long) As Long

Private Declare Function CreatePolygonRgn Lib "gdi32" _
 (ByRef P1 As Any, ByVal NumP As Long, ByVal Mode As Long) As Long

Private Declare Function SetWindowRgn Lib "user32" _
 (ByVal hWnd As Long, ByVal hRgn As Long, _
 ByVal bRedraw As Boolean) As Long

Private Sub Form_Load()
Dim Ttpsize As Integer
Dim Brdsize As Integer
Dim DipScale As Integer
Dim Rngsize As Long

TextToolTip.Caption = Tooltiptext
DipScale = TextWidth(" ")
Ttpsize = TextWidth(TextToolTip.Caption & " ")
TextToolTip.Width = Ttpsize

Brdsize = DipScale * 1

Me.Width = TextToolTip.Width + Brdsize * 2
Me.Height = (TextToolTip.Width + Brdsize * 2) * Bubblefac

TextToolTip.Left = Brdsize
TextToolTip.Top = Brdsize * 30 * Bubblefac

Rngsize = (Ttpsize + Brdsize * 2) / DipScale * (DipScale / Screen.TwipsPerPixelX)

SetWindowRgn hWnd, CreateEllipticRgn(0, 0, Rngsize, 200 * Bubblefac), True
'Call amazingborder
End Sub

Sub amazingborder()
ReDim MYREC(4)
MYREC(0).X = 20
MYREC(0).Y = 20
MYREC(1).X = 100
MYREC(1).Y = 0
MYREC(2).X = 200
MYREC(2).Y = 40
MYREC(3).X = 200
MYREC(3).Y = 80
MYREC(4).X = 20
MYREC(4).Y = 70

SetWindowRgn hWnd, CreatePolygonRgn(MYREC(0), 5, 2), True
End Sub



Attribute VB_Name = "Module1"
Public Tooltiptext As String
Public Bubblefac As Single

   X As Long
   Y As Long
End Type

Sub main()
Tooltiptext = "This is a little message that appears in a elipse!"
Bubblefac = 0.5
Form1.Left = 150 * Screen.TwipsPerPixelX
Form1.Top = 150 * Screen.TwipsPerPixelY
End Sub


Set the Startup to "Sub Main" ....

When you start the program an elliptic bubble will appears
at the window screen position 150/150.

The example works only for one line of bubble text ...
You can set the text in the main procedure ...
You can set also the bubble factor:
1 means circle
0.5 means elliptic (width)
1.5 means elliptic (height)

Have fun the code was a little hard to code


The amazingborder routine can used such as the function
SetWindowRgn hWnd, CreateEllipticRgn(0, 0, Rngsize, 200 * Bubblefac), True

but you must adjust the correct setting for the numbers
Lots of fun
AllannAuthor Commented:
Thanks dude...  helped a lot...

btw, i found this the other night which combined with your answer has netted me with a great little tooltip balloon.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now