At the moment u want to display the menu, with TrackPopupMenu I guess, you just look at the return value, which is the Index of the menuitem.
So if you want to display a menu on a MouseUp on the Form, you have something like this:
[tt]Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim lpPoint As POINTAPI
Dim lReturn As Long
Call GetCursorPos(lpPoint)
lReturn = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN, lpPoint.x, lpPoint.y, 0, Me.hwnd, ByVal 0&)
Select Case lReturn
'here you should compare the ID to the ID's of the Items you've added to the PopupMenu
End Select
End Sub[/tt]