ToolTip 2.1

I’ve released a new version of the ToolTip VB6 class. Now it fully works if data execution prevention (DEP) is activated.

9 thoughts on “ToolTip 2.1”

  1. You want to change the tool tip’s font? There is the hFont property which takes a handle to the font. Make sure you have

    #Const FullFeatured = True

    in the beginning of the class.
    However, I’m not sure that the font can be set, if your application uses Windows themes and runs on Windows Vista or newer.

  2. can you give me a code to change the tooltip text displayed in the font?
    i need it urgently. thank for your help.
    Do you have Unicode msgbox class?

  3. Currently I’m at work, but tonight I’ll try to find time to provide such a sample.

    To get a Unicode MsgBox you simply have to use the MessageBoxW Win32 API function instead of VB’s MsgBox. Have a look at the OfficeStyle sample that comes with my ToolBarControls. It uses this function.

  4. Starting with Windows Vista, the tooltip will ignore the custom font if the tool bar uses Windows themes. Besides this limitation, the following code will work:

    Private Type LOGFONT
    lfHeight As Long
    lfWidth As Long
    lfEscapement As Long
    lfOrientation As Long
    lfWeight As Long
    lfItalic As Byte
    lfUnderline As Byte
    lfStrikeOut As Byte
    lfCharSet As Byte
    lfOutPrecision As Byte
    lfClipPrecision As Byte
    lfQuality As Byte
    lfPitchAndFamily As Byte
    lfFaceName(1 To 64) As Byte
    End Type
    Private hFont As Long

    Private Declare Function CreateFontIndirect Lib “gdi32.dll” Alias “CreateFontIndirectW” (ByRef lpLogFont As LOGFONT) As Long
    Private Declare Function DeleteObject Lib “gdi32.dll” (ByVal hObject As Long) As Long
    Private Declare Function lstrcpynWAsLong Lib “kernel32.dll” Alias “lstrcpynW” (ByVal lpString1 As Long, ByVal lpString2 As Long, ByVal iMaxLength As Long) As Long

    Private Sub Form_Load()
    Dim lf As LOGFONT

    With lf
    lstrcpynWAsLong VarPtr(.lfFaceName(1)), StrPtr(“Comic Sans MS”), 64
    .lfHeight = -10
    .lfWeight = 400
    End With
    hFont = CreateFontIndirect(lf)
    With ttToolTip
    .Create Me.hWnd
    .Activate
    .hFont = hFont
    .AddTool…
    End With
    End Sub

    Private Sub Form_Terminate()
    DeleteObject hFont
    End Sub

    Note: The code for setting lf.lfHeight actually is wrong, but I don’t have time to do it properly now. Google for CreateFontIndirect + MulDiv + GetDeviceCaps and you should find the correct solution.

  5. The above code can not run(VB XP SP3) , there are a lot of compile errors , I hope you can upgrade the following to your Tooltip class module , so that everyone benefits , thank you for your reply

  6. It would be helpful if you would tell me which compile errors you get.

    MessageBoxW online about how the code is not ah ?
    Sorry, I don’t understand this question. Can you rephrase it?

Comments are closed.