MFC ON_COMMAND problem
-
Hi, for some reason i can only call ON_COMMAND in my main dialog, how can i call it in a child dialog? Any ideas would be much apreciated!
-
Hi, for some reason i can only call ON_COMMAND in my main dialog, how can i call it in a child dialog? Any ideas would be much apreciated!
How can you call ON_COMMAND? ON_COMMAND is not a function or method AFAIK. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
How can you call ON_COMMAND? ON_COMMAND is not a function or method AFAIK. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Hi Mark, I call it via afx_msg void OnAddNewItem(); and ON_COMMAND(ID__ADDITEM, &CItemDlg::OnAddNewItem) Edit: the menu item is created via CMenu and if i move ON_COMMAND(ID__ADDITEM, &CItemDlg::OnAddNewItem) to the main dialog it works fine. But i want to know why i cant call it in the child dialog
-
Hi Mark, I call it via afx_msg void OnAddNewItem(); and ON_COMMAND(ID__ADDITEM, &CItemDlg::OnAddNewItem) Edit: the menu item is created via CMenu and if i move ON_COMMAND(ID__ADDITEM, &CItemDlg::OnAddNewItem) to the main dialog it works fine. But i want to know why i cant call it in the child dialog
You aren't calling anything. You've added a method that will get called when the window you've added it to receives a WM_COMMAND message corresponding to a menu item or child window with the id "ID__ADDITEM". Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
You aren't calling anything. You've added a method that will get called when the window you've added it to receives a WM_COMMAND message corresponding to a menu item or child window with the id "ID__ADDITEM". Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Ok, how do i associate the menu to the dialog? The menu opens when right mouse button is pressed and so i dont care to attatch it to the Child Dialogs system menu.
-
Ok, how do i associate the menu to the dialog? The menu opens when right mouse button is pressed and so i dont care to attatch it to the Child Dialogs system menu.
FredrickNorge wrote:
...how do i associate the menu to the dialog? The menu opens when right mouse button is pressed...
The TrackPopupMenu() API/method takes a window handle/ptr to the window that should receive the command messages. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
FredrickNorge wrote:
...how do i associate the menu to the dialog? The menu opens when right mouse button is pressed...
The TrackPopupMenu() API/method takes a window handle/ptr to the window that should receive the command messages. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Thanks, that made it work :)