eleteroboltz
Technical User
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
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