Results 1 to 3 of 3

Thread: Toolbar tooltips under the form...

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Toolbar tooltips under the form...

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function ExtractFileIcon Lib "shell32.dll" Alias "ExtractAssociatedIconA" (ByVal hInst As Long, _
    4.                                                                                            ByVal lpIconPath As String, _
    5.                                                                                            lpiIcon As Long) _
    6.                                                                                            As Long
    7. Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, _
    8.                                                 ByVal x As Long, _
    9.                                                 ByVal y As Long, _
    10.                                                 ByVal hIcon As Long) _
    11.                                                 As Long
    12.  
    13. Private Sub Toolbar1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
    14. Dim p  As Long
    15. Dim i  As Long
    16. Dim tb As MSComctlLib.Button
    17.  
    18.     If Data.GetFormat(vbCFFiles) Then
    19.         For p = 1 To Data.Files.Count
    20.             i = GetILIconIndex(Data.Files(p))
    21.             Set tb = Toolbar1.Buttons.Add(, , "", , i)
    22.                 tb.ToolTipText = Data.Files(p)
    23.         Next
    24.     End If
    25.  
    26.     Set tb = Nothing
    27.    
    28. End Sub
    29.  
    30. Private Function GetILIconIndex(ByVal sFile As String) As Long
    31. Dim hIcon As Long
    32. Dim li    As ListImage
    33.  
    34.     Picture1.Picture = LoadPicture
    35.     hIcon = ExtractFileIcon(App.hInstance, sFile, 0&)
    36.    
    37.     If hIcon Then
    38.         Call DrawIcon(Picture1.hdc, 0, 0, hIcon)
    39.     End If
    40.    
    41.     Picture1.Picture = Picture1.Image
    42.     Set li = ImageList1.ListImages.Add(, , Picture1.Picture)
    43.  
    44.     GetILIconIndex = li.Index
    45.     Picture1.Picture = LoadPicture
    46.  
    47.     Set li = Nothing
    48.    
    49. End Function

    I'm basically using this code to allow for file shorcuts on a toolbar. The problem is that the tooltips for the buttons seem to be showing up underneath the toolbar's parent form. Any idea why this would be happening?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    New Member
    Join Date
    Apr 2010
    Posts
    1

    Re: Toolbar tooltips under the form...

    Did you ever find a solution for this? I have a similar issue with a home-grown OCX. When it's loaded into a specific host application, which is set to "Always on Top" the tooltips for my OCX show up behind the host application. If "Always on Top" is disabled the tooltips show up properly.

    Eric

  3. #3
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Toolbar tooltips under the form...

    edqilson97, welcome to the forums. You shouldn't bump old threads. This one is 7 years old. You can either ask the user via PM, or create a new thread and post your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width