Solved

General Info Tip

Posted on 2001-07-13
5
195 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:Allann
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:WolfgangKoenig
ID: 6280220
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

Bye
WoK
0
 
LVL 2

Author Comment

by:Allann
ID: 6289347
do you have an example of your explanation?
0
 
LVL 4

Accepted Solution

by:
WolfgangKoenig earned 100 total points
ID: 6290591
Ok, here the little tricky code:

Form1.frm:
-----------------------------------------------------------

VERSION 5.00
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
   End
End
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
Show

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

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

Sub amazingborder()
Dim MYREC() As PUNKT
ReDim MYREC(4)
Show
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

-----------------------------------------------------------


Module1.bas:
-----------------------------------------------------------


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

Type PUNKT
   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.Show
Form1.Left = 150 * Screen.TwipsPerPixelX
Form1.Top = 150 * Screen.TwipsPerPixelY
End Sub

-----------------------------------------------------------


Attention:
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

WoK










0
 
LVL 4

Expert Comment

by:WolfgangKoenig
ID: 6290597
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
WoK
0
 
LVL 2

Author Comment

by:Allann
ID: 6293081
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.

http://www.vbthunder.com/software/ExCooltips/index.html
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now