Click here to Skip to main content
Sign Up to vote bad
good
See more: MFCVC++
I have written only this code in MDI application
My toolbar button gets removed by On Button.
The issue is that If I run and test the application to remove the button two or three times , The next time I dont require to press button,toolbar button gets automatically removed.Even after clean and rebuild ,even after closing project and
Rebuiding again toolbar button does not reappear.What is this bug or intellisence
Can anyone tell me What is this ?
 
void CMerilisaRApp::OnButton()
{
    ((CMainFrame*)(AfxGetApp()->GetMainWnd()))->ApplyPolicy();
}
 

void CMainFrame::ApplyPolicy(void)
{
    m_wndToolBar.RemoveButton(4);
    
}
Posted 19-Sep-12 0:45am


1 solution

You should first add a test for that button existing. You should also use button identifiers rather than indices in case your code gets called multiple times. Are you really sure that you want this removed rather than disabled?
  Permalink  
Comments
adityarao31 - 19-Sep-12 7:34am
Yah your suggestion is good ,but I am sure code is inserted at a place and unless click event is raised it is not getting called,this is something very strange,I am running application and finding that button is not there
Richard MacCutchan - 19-Sep-12 8:34am
It's impossible to suggest anything more since we do not know what is going on in your program. Unfortunately the only way to make progress with issues like this is to spend time with the debugger.
adityarao31 - 19-Sep-12 10:32am
Perhaps what you say Is Right,but I feel Visual Studio 2010 is not so stable version
Richard MacCutchan - 19-Sep-12 10:46am
No, I'm pretty sure you are doing something wrong, but, as I said, without a lot more information it's impossible to guess what.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Christian Graus 478
1 Ron Beyer 306
2 Tadit Dash 253
3 samadhan_kshirsagar 229
4 OriginalGriff 198
0 Sergey Alexandrovich Kryukov 7,041
1 Prasad_Kulkarni 3,815
2 OriginalGriff 3,557
3 _Amy 3,372
4 CPallini 3,034


Advertise | Privacy | Mobile
Web01 | 2.6.130619.1 | Last Updated 19 Sep 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid