Tool Tips for ToolBar "drop down" menus

Posted on 2003-03-20
Medium Priority
Last Modified: 2010-04-07
How can I get my drop drown menus to display a Tool Tip utilizing the tooltip property as I highlight them with either my mouse or as I scroll down with the arrows.

The below is for a command button, but I need something for

Label1.Caption = Command1.Tag
Label1.Top = Command1.Top + Command1.Height
Label1.Left = Command1.Left + Command1.Width / 2
Label1.Visible = True
Command1.Tag = "This is the TAG TIP"
Label1.Visible = False

If you need any additiona info, let me know.
Question by:GlobalFax
  • 2
LVL 11

Accepted Solution

supunr earned 2000 total points
ID: 8178933
may be this will give you a start.

create a module and put this code...

Option Explicit

Public OldWndProc As Long
Public gWH As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Public Const GWL_WNDPROC = -4

Function LowOrd(DbleWord As Long) As Integer
    If DbleWord And &H8000& Then
        LowOrd = &H8000 Or (DbleWord And &H7FFF&)
        LowOrd = DbleWord And &HFFFF&
    End If
End Function

Function WindowProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    On Error Resume Next
    Dim X As Long
    Dim MenuText(0 To 75) As String
    X = CallWindowProc(OldWndProc, hwnd, Msg, wParam, lParam)
    Select Case Msg
        Case WM_MENUSELECT
            MenuText(0) = ""   '    "&File"
            MenuText(1) = ""   '    "&File"
            MenuText(2) = "Print the products table."   '       "Open"
            MenuText(3) = "Exit the program"   '       "E&xit "

            Dim Index As Long
            Index = (wParam And &H100000) Or LowOrd(wParam)
            If (Index >= 0 And Index < 4) Then ' ignore main menus
                Form1.Print MenuText(LowOrd(wParam))
                Form1.Print ""
            End If
    End Select
    WindowProc = X
    On Error GoTo 0
End Function

' Now create a form with File menu and inside that Open and Exit menu options

in the form_load function, put the following code...

Private Sub Form_Load()
    gWH = Me.hwnd
    OldWndProc = SetWindowLong(gWH, GWL_WNDPROC, AddressOf WindowProc)
End Sub

You could play around this code and get it to work the way you want.  I am not sure how you could get a tooltip though.  Only option you could do is show these help messages in a statusbar control of the same form (similar to IE, etc.)

Good Luck!

Author Comment

ID: 8207472
Answer accepted with a few modifications.

Thanks for your help!

Author Comment

ID: 8239750
Answer accepted with a few modifications.

Thanks for your help!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

616 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