Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CommandBar ShowPopUp error

Status
Not open for further replies.

eleteroboltz

Technical User
Jan 5, 2009
7
BR
I keep getting the "ShowPopup method failed" error. If anyone can help me i would be very grateful.

CODE:

Option Compare Database
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long

Private Sub filemenu_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim pt As POINTAPI
Dim myBar As Variant
Dim NbPointParPouceX As Long, NbPointParPouceY As Long
GetCursorPos pt
NbPointParPouceX = GetDeviceCaps(GetDC(0), 88)
NbPointParPouceY = GetDeviceCaps(GetDC(0), 90)

CommandBars("filemenu").ShowPopup pt.X - (X / (1440 / NbPointParPouceX)), pt.Y + (Me.filemenu.Height - Y) / (1440 / NbPointParPouceY)

End Sub
 
This works fine with a custom toolbar (I tested it), but I think this requires a popup toolbar. I do not think it will work with the filemenu since it is not popup.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top