Re: Writing a right-button popup menu

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jeff Johnson (i.get_at_enough.spam)
Date: 08/15/04


Date: Sat, 14 Aug 2004 21:42:16 -0400


"Stan Hilliard" <usenetreplyMS@samplingplansNOTSPAM.com> wrote in message
news:vh7th09a47luaoaimpl7e80o3lvfn386s8@4ax.com...

> 1) My code above refers to the menu "mnuWindowMenu" on the MDI.
> I want to add another item to the popup that is not in the
> "mnuWindowMenu" menu -- like the "select-all" item from the edit
> menu.
> How can I add that other item to the popup without changing the
> "mnuWindowMenu" menu that is shown on the MDI?

Put the item in the menu and set its Visible property to False. In your
right-click handler, make it visible. In the mnuWindowMenu_Click event, make
it invisible.

> 2) Textboxes already apparently have a default right click popup menu
> that comes up prior to my popup. How can I turn that off?

Declare the API function ReleaseCapture() and call it when you detect a
right mouse click. Personally, I think the best way is to subclass the text
box and eat the WM_CONTEXTMENU message, but the above suggestion will work
as well. You'll probably also get the "pure VB" suggestion of disabling and
enabling the text box, but I think that's just cheesy and won't suggest it.
Oh, wait...damn!


Quantcast