Solved

Activating pop-up menu in an ActiveX Control?

Posted on 1998-09-22
2
260 Views
Last Modified: 2013-11-28
I have a pop-up menu assigned to the right button of the mouse. The problem I faced is that the menu are all disabled and I couldn't use the mouse to do any selection. I tried to use EnableMenuItem to enable the items in the pop-up menu but it still didn't enable it. Can anyone please help me with this.
And also in which function should my command be assigned? Because in CWnd, I would place my command in the On_Command function. But in the ActiveX program, I can't seem to utilise the On_OcmCommand in the function.
0
Comment
Question by:g7677
2 Comments
 
LVL 2

Accepted Solution

by:
igroove earned 100 total points
ID: 1173500
If you're using Visual C++ 4.1 or higher...
.open your menu in the resource view (as if you were going to modify it).  Enter the class wizard.  It'll ask you if you want to create a new class or link it to an existing one.  Link it to your class file where your control lives.  Make sure it follows the AFX macros structure (the //{{AFX_MSG() and all those wizard-like things) before you do this.  It should hook it up for you (that is, hook up the proper command routing).  Then its just like doing regular MFC. (ON_COMMAND(x, f)...)

Visual C++, MFC 4.2 note:
Are you just intercepting the WM_RBUTTON message?  If keyboard jocks are hitting the context menu key...intercept WM_CONTEXT...that'll take care of any input way they want. Rbutton, keyboard clicks, etc.
0
 

Author Comment

by:g7677
ID: 1173501
My pop-up menu is created in the program itself upon right mouse click. So I can't open the menu in the resource view or go into the class wizard for the menu.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Read about how to choose the best possible content marketing agency to suit your needs. Content marketing has become an integral part of running a successful tech business, so it is wise to be informed.
Learn about the eCommerce marketing trends for the year ahead.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question