call menu item from program
-
I am trying to call menu from dialog. That menu's ID is ID_MYMENU. When you click on this button, it will do certain thing. what i am trying to do is to call this ID_MYMENU from dialog and do the same thing as when you click on the ID_MYMENU. I was thinking to use function like SendMessage(ID_MYMENU,**,**) something like this. Please help! Shin
-
I am trying to call menu from dialog. That menu's ID is ID_MYMENU. When you click on this button, it will do certain thing. what i am trying to do is to call this ID_MYMENU from dialog and do the same thing as when you click on the ID_MYMENU. I was thinking to use function like SendMessage(ID_MYMENU,**,**) something like this. Please help! Shin
You don't need to call the menu from a button. If you want more than 1 GUI object to be handled by the same code, then you should just edit the message maps to point to the same function.
-
I am trying to call menu from dialog. That menu's ID is ID_MYMENU. When you click on this button, it will do certain thing. what i am trying to do is to call this ID_MYMENU from dialog and do the same thing as when you click on the ID_MYMENU. I was thinking to use function like SendMessage(ID_MYMENU,**,**) something like this. Please help! Shin
If your dialog box is modal, it could be dangerous to activate a command of the application. Anyway, here's the syntax: CMainFrame *pFrame = AfxGetApp()->m_pMainWnd; pFrame->SendMessage(WM_COMMAND, ID_MYMENU); Beware that with SendMessage, the call won't return before the execution of the command.
Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy
-
If your dialog box is modal, it could be dangerous to activate a command of the application. Anyway, here's the syntax: CMainFrame *pFrame = AfxGetApp()->m_pMainWnd; pFrame->SendMessage(WM_COMMAND, ID_MYMENU); Beware that with SendMessage, the call won't return before the execution of the command.
Silence Means Death Stand On Your Feet Inner Fear Your Worst Enemy
-
Thank you very much. in this way, I can save a lot of time. however, I will be carefull with those point you mensioned. Thanks, again. Shin:laugh: