Click here to Skip to main content
15,896,606 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: List Box & Rich Edit box Pin
David Crow16-Feb-07 2:52
David Crow16-Feb-07 2:52 
QuestionWindows Menus and the WM_MENUCOMMAND message Pin
Martin081515-Feb-07 22:41
professionalMartin081515-Feb-07 22:41 
QuestionRe: Windows Menus and the WM_MENUCOMMAND message Pin
prasad_som16-Feb-07 1:51
prasad_som16-Feb-07 1:51 
AnswerRe: Windows Menus and the WM_MENUCOMMAND message Pin
Martin081516-Feb-07 2:22
professionalMartin081516-Feb-07 2:22 
AnswerRe: Windows Menus and the WM_MENUCOMMAND message Pin
prasad_som16-Feb-07 3:08
prasad_som16-Feb-07 3:08 
QuestionRe: Windows Menus and the WM_MENUCOMMAND message Pin
Martin081516-Feb-07 3:56
professionalMartin081516-Feb-07 3:56 
AnswerRe: Windows Menus and the WM_MENUCOMMAND message Pin
prasad_som16-Feb-07 5:00
prasad_som16-Feb-07 5:00 
GeneralRe: Windows Menus and the WM_MENUCOMMAND message Pin
Martin081516-Feb-07 6:31
professionalMartin081516-Feb-07 6:31 
Ok - got it working - a bit different than you told me to, and with a lot of consequences.

The current state:

1. we have a MFC application
2. our MFC application has a resource based menu, with one ON_COMMAND handler per menu item
3. I wrote a tcl API to access the MFC application menu, which allows to create new sub menus and menu items.
4. before I insert a popup menu, I switch the MFC application menu MENUINFO to MNS_NOTIFYBYPOS, so that WM_MENUCOMMAND messages are used, instead of WM_COMMAND messages
5. after inserting a popup menu, I switch the new sub menu to use WM_MENUCOMMAND messages
6. I registered a ON_MESSAGE handler for WM_MENUCOMMAND messages

The consequences:

1. None of the resource based menu items, with ON_COMMAND handlers, will work anymore, because there are no WM_COMMAND messages anymore
2. every selected menu item causes the wanted WM_MENUCOMMAND message
3. every menu in the "path" of (sub)menus seem to have this MENUINFO style flag MNS_NOTIFYBYPOS, so that this model is really working.
If I don't switch all containing menus of a sub menus to send WM_MENUCOMMAND messages, than the whole model won't work.
The suggestion above to use TrackPopupMenu must work, if the popup menu is used all alone, but if it is used inside a "path" of cascaded menus, than this would be more problematic.
4. the whole menu system of ON_COMMAND handlers must be rewritten, or I must find a way to get rid of the dummy or template menu item and create resources on the fly, but ... I don't know how!

A change of question:

How do I create on-the-fly resources or menu items with new, non-existing IDs?

If I'd know, how to create on-the-fly resources, than I could stay with the normal WM_COMMAND system.

Thanks to you Prasad!

Best regards, and a happy weekend!

Martin Lemburg
QuestionDebugging capability Pin
mt_samiei15-Feb-07 22:39
mt_samiei15-Feb-07 22:39 
AnswerRe: Debugging capability Pin
Cedric Moonen15-Feb-07 22:50
Cedric Moonen15-Feb-07 22:50 
GeneralRe: Debugging capability Pin
mt_samiei15-Feb-07 23:03
mt_samiei15-Feb-07 23:03 
GeneralRe: Debugging capability Pin
NiceNaidu15-Feb-07 23:07
NiceNaidu15-Feb-07 23:07 
Questionkbhit() Question Pin
Programm3r15-Feb-07 20:57
Programm3r15-Feb-07 20:57 
AnswerRe: kbhit() Question Pin
Programm3r15-Feb-07 21:10
Programm3r15-Feb-07 21:10 
GeneralRe: kbhit() Question Pin
prasad_som15-Feb-07 22:29
prasad_som15-Feb-07 22:29 
AnswerRe: kbhit() Question [modified] Pin
prasad_som15-Feb-07 21:54
prasad_som15-Feb-07 21:54 
AnswerRe: kbhit() Question Pin
David Crow16-Feb-07 3:19
David Crow16-Feb-07 3:19 
QuestionMessagebox Question Pin
Programm3r15-Feb-07 20:47
Programm3r15-Feb-07 20:47 
AnswerRe: Messagebox Question Pin
toxcct15-Feb-07 20:52
toxcct15-Feb-07 20:52 
GeneralRe: Messagebox Question Pin
Programm3r15-Feb-07 20:57
Programm3r15-Feb-07 20:57 
QuestionENTER and SHIFT+ENTER in simple text edit box (EDITTEXT) Pin
deivakumar15-Feb-07 20:10
deivakumar15-Feb-07 20:10 
QuestionRe: ENTER and SHIFT+ENTER in simple text edit box (EDITTEXT) Pin
kakan15-Feb-07 20:30
professionalkakan15-Feb-07 20:30 
AnswerRe: ENTER and SHIFT+ENTER in simple text edit box (EDITTEXT) Pin
Michael Dunn15-Feb-07 20:43
sitebuilderMichael Dunn15-Feb-07 20:43 
QuestionQuick repaints Pin
BishGada15-Feb-07 19:42
BishGada15-Feb-07 19:42 
QuestionRe: Quick repaints Pin
prasad_som15-Feb-07 19:53
prasad_som15-Feb-07 19:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.