kung
asked on
check/uncheck a menu item
I am using Visual C++ 6.0
I have made a "hello world" program via the wizard
I have added a menu item to the window
with the name ID_CONNECTIONS
My question is
I want, when the user select the menu item, check and uncheck the menu item with the name ID_CONNECTIONS.
What source code should I add to the project created by
the wizard so this happends.
I have made a "hello world" program via the wizard
I have added a menu item to the window
with the name ID_CONNECTIONS
My question is
I want, when the user select the menu item, check and uncheck the menu item with the name ID_CONNECTIONS.
What source code should I add to the project created by
the wizard so this happends.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You'll have to obtain the meu handle for your window first:
CMenu *pmenu = AfxGetMainWnd()->GetMenu()
pmenu->CheckMenuItem ( ID_CONNECTIONS, MF_BYCOMMAND | MF_CHECKED); // to check the item
pmenu->CheckMenuItem ( ID_CONNECTIONS, MF_BYCOMMAND | MF_UNCHECKED); // to uncheck the item