About
Pricing
Community
Teams
Start Free Trial
Log in
kuldeepruhela
asked on
2/25/2009
How to Disable Some Tools from Toolbar in VC++6.0/MFC SDI Application
hi all
i have an VC++6.0/MFC SDI Application in which i want to Disable some Tools from Toolbar.
Please tell me how to do it.
send the vc++/mfc CODE
System Programming
6
1
Last Comment
alb66
8/22/2022 - Mon
alb66
2/25/2009
If ID_YOURTOOL is the ID of your tool you can do this:
in .h file:
afx_msg void OnUpdateYourTool(CCmdUI *pCmdUI);
in .cpp file:
BEGIN_MESSAGE_MAP(CYourVie
w, CView)
ON_UPDATE_COMMAND_UI( ID_YOURTOOL, OnUpdateYourTool)
END_MESSAGE_MAP()
void CYourView::OnUpdateYourToo
l(CCmdUI *pCmdUI)
{
BOOL bEnable = ... <---- your condition;
pCmdUI->Enable( bEnable );
}
alb66
2/25/2009
For a complete explanation you can read "How to Update User-Interface Objects" at
http://msdn.microsoft.com/en-us/library/72t5ykb7(VS.71).aspx
kuldeepruhela
2/25/2009
ASKER
hi alb66
i am using your first Suggestion for disable a tool from a toolbar now i need that when i click on a Button it should be Enable.
Please tell me how to do it
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
kuldeepruhela
2/25/2009
ASKER
hi all
i am using following Solution
If ID_YOURTOOL is the ID of your tool you can do this:
in .h file:
afx_msg void OnUpdateYourTool(CCmdUI *pCmdUI);
in .cpp file:
BEGIN_MESSAGE_MAP(CYourVie
w, CView)
ON_UPDATE_COMMAND_UI( ID_YOURTOOL, OnUpdateYourTool)
END_MESSAGE_MAP()
void CYourView::OnUpdateYourToo
l(CCmdUI *pCmdUI)
{
BOOL bEnable = ... <---- your condition;
pCmdUI->Enable( bEnable );
}
to disable a tool from a toolbar now i need that when i click on a Button it should be Enable.
Please tell me how to do it
ASKER CERTIFIED SOLUTION
alb66
2/25/2009
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
alb66
2/26/2009
Hey kuldeepruhela, why B grade? Something was wrong or incomplete?
in .h file:
afx_msg void OnUpdateYourTool(CCmdUI *pCmdUI);
in .cpp file:
BEGIN_MESSAGE_MAP(CYourVie
ON_UPDATE_COMMAND_UI( ID_YOURTOOL, OnUpdateYourTool)
END_MESSAGE_MAP()
void CYourView::OnUpdateYourToo
{
BOOL bEnable = ... <---- your condition;
pCmdUI->Enable( bEnable );
}