Click
here for another reference with a little more explanation on the Windows functions called and a LabView 6 version of the same example crediting the author Nadav Chernin.
One note on the example posted here and by Mads: the call to FindWindowA function in Show Pop-Up Menu.vi expects an exact match of the VI name and the name in the window title bar. If the LabView options are set to Show revision number in title bar, FindWindowA will not find a match and the popup will not be displayed. FindWindo
wA will return an hWnd of 0 (invalid) which should generate an Error Out ( but doesn't in this version). Show revision in title bar is controlled through the menu under Tools >> Options >> Revision History (in pulldown listbox).
To detect the right-click, create an event structure, add a Mouse Down event for the control you want to be able to right-click. You detemine right or left click by checking the Button output (left-hand side) in the event case. Depending on how big you made your event structure, Button may not be displayed initially, but you can right-click on Type and goto Select Item >> Button. Button 1 is left-click, button 2 is right-click.