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?