Click here to Skip to main content
15,914,350 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Beat me to it Pin
Bill Gates Antimatter Particle27-Jan-03 7:34
Bill Gates Antimatter Particle27-Jan-03 7:34 
GeneralFind active Child Frame in MDI app Pin
Aaron Schaefer27-Jan-03 4:30
Aaron Schaefer27-Jan-03 4:30 
GeneralRe: Find active Child Frame in MDI app Pin
HENDRIK R27-Jan-03 4:41
HENDRIK R27-Jan-03 4:41 
GeneralTool Bars Pin
will138327-Jan-03 4:27
will138327-Jan-03 4:27 
GeneralRe: Tool Bars Pin
RobJones27-Jan-03 7:17
RobJones27-Jan-03 7:17 
GeneralRe: Tool Bars Pin
will138327-Jan-03 8:59
will138327-Jan-03 8:59 
GeneralRe: Tool Bars Pin
RobJones27-Jan-03 9:12
RobJones27-Jan-03 9:12 
GeneralRe: Tool Bars Pin
PJ Arends27-Jan-03 11:51
professionalPJ Arends27-Jan-03 11:51 
Ok, here comes a real hack that does work, but once implemented you will not be able to change your toolbar using the toolbar resource editor, so make sure you have all your buttons set up in their default states first.

1.) Using MSPaint (or another graphics editing tool) extend the toolbar bitmap by adding the new bitmaps you want to the end of it. remember to make all the images the same size (default is 16 x 15 pixels)

2.) to the class that will handle the button states, add an integer variable that will keep track of which bitmap is currently displayed on each button (use seperate variables or an array of them). The variable will hold the index number of the image in the bitmap. remember that the first image in the bitmap is at index 0 not 1.

3.) add an ON_COMMAND message handler for the button being clicked. in that handler, change the index variable to contain the index of the new image

4.) add an ON_UPDATE_COMMAND_UI handler for the button. here you check if the command is coming from the toolbar (as opposed to the menu), and then you use CToolBar::SetButtonInfo() to change the image.

CMyView::OnUpdateAppAbout(CCmdUI* pCmdUI)
{
    if (pCmdUI->m_pOther && pCmdUI->m_pOther->IsKindOf(RUNTIME_CLASS(CToolBar)))
    {
        CToolBar *pTB = (CToolBar *)pCmdUI->m_pOther;
        pTB->SetButtonInfo(pCmdUI->m_nIndex, pCmdUI->m_nID, TBBS_BUTTON, m_nAboutImage);
    }
}


although you may want to use CToolBar::GetButtonInfo() to get the button style





CPUA 0x5041

Sonork 100.11743 Chicken Little

"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies

Within you lies the power for good - Use it!
GeneralColouring one row of CListView Class:) Pin
omer ejaz27-Jan-03 4:10
sussomer ejaz27-Jan-03 4:10 
GeneralRe: Colouring one row of CListView Class:) Pin
HENDRIK R27-Jan-03 4:44
HENDRIK R27-Jan-03 4:44 
GeneralRe: Colouring one row of CListView Class:) Pin
Michael Dunn27-Jan-03 5:21
sitebuilderMichael Dunn27-Jan-03 5:21 
GeneralRe: NM_CUSTOMDRAW Pin
Bill Gates Antimatter Particle27-Jan-03 8:02
Bill Gates Antimatter Particle27-Jan-03 8:02 
GeneralRe: NM_CUSTOMDRAW Pin
Michael Dunn29-Jan-03 19:43
sitebuilderMichael Dunn29-Jan-03 19:43 
GeneralQuestion 2 - (threads and message pump) Pin
Nitron27-Jan-03 3:50
Nitron27-Jan-03 3:50 
GeneralRe: Question 2 - (threads and message pump) Pin
PJ Arends27-Jan-03 7:06
professionalPJ Arends27-Jan-03 7:06 
GeneralRe: Question 2 - (threads and message pump) Pin
Nitron27-Jan-03 13:49
Nitron27-Jan-03 13:49 
GeneralQuestion 1 - (files/folders) Pin
Nitron27-Jan-03 3:45
Nitron27-Jan-03 3:45 
GeneralRe: Question 1 - (files/folders) Pin
Martyn Pearson27-Jan-03 3:56
Martyn Pearson27-Jan-03 3:56 
GeneralRe: Question 1 - (files/folders) Pin
Nitron27-Jan-03 6:40
Nitron27-Jan-03 6:40 
GeneralHTREEITEM lifetime Pin
Martyn Pearson27-Jan-03 3:34
Martyn Pearson27-Jan-03 3:34 
GeneralRe: HTREEITEM lifetime Pin
HENDRIK R27-Jan-03 4:52
HENDRIK R27-Jan-03 4:52 
GeneralRe: HTREEITEM lifetime Pin
Michael Dunn27-Jan-03 5:23
sitebuilderMichael Dunn27-Jan-03 5:23 
QuestionADO Control ? Pin
Romeo27-Jan-03 3:25
Romeo27-Jan-03 3:25 
AnswerRe: ADO Control ? Pin
Ahmad9927-Jan-03 4:03
Ahmad9927-Jan-03 4:03 
Questionwant to block IE popups??? Pin
xxhimanshu27-Jan-03 1:33
xxhimanshu27-Jan-03 1:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.