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

C / C++ / MFC

 
Generalcrash on exit in release version with PostMessage!!!!! Help!!! Pin
ns27-Jan-03 4:33
ns27-Jan-03 4:33 
GeneralRe: crash on exit in release version with PostMessage!!!!! Help!!! Pin
Michael Dunn27-Jan-03 5:19
sitebuilderMichael Dunn27-Jan-03 5:19 
GeneralGosh!!!! MAny many mnay thanks!!!! Pin
ns27-Jan-03 5:25
ns27-Jan-03 5:25 
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 
Hello,
Hopefully this helps...


groover4life wrote:
1) when setting up a button on a tool bar to be multiple state (i.e. start/stop) and I want to change the bitmap displayed on the button, how do I change the bitmap on the button?

The following code should help.. I create a function so that if a button is pressed and the bitmap needs to be changed.. change the bitmap for the whole tool bar (to either ON or OFF).. if a button is pressed and you dont need to change the bitmaps don't run the following... You get the idea..

You will need to create 2 bitmaps for the tool bar.. one for "ON" and one for "OFF".. both these bitmaps need to be in your resoruces tab..

////////////////////////////////////////////////////////////////////////////////////
// THIS IS FOR SETTING THE OFF BITMAP

// Get the old ImageList and then destroy it.
HIMAGELIST hOld = (HIMAGELIST)::SendMessage(m_wndToolBar, TB_GETIMAGELIST, 0, 0);
ImageList_Destroy(hOld);

// Set up image lists.
CImageList imageList;
CBitmap    bitmap;

// Create and set the toolbar image list.
bitmap.LoadBitmap(IDB_OFF); <-- BITMAP IN RESOURCE
imageList.Create(16, 16, ILC_COLORDDB|ILC_MASK, 3, 1);
imageList.Add(&bitmap, RGB(255,0,255)); 

// Set the new image list on the toolbar
m_wndToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
						
// Clean up
imageList.Detach();
bitmap.DeleteObject();
// END OF OFF BITMAP
///////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////
// THIS IS FOR SETTING THE ON BITMAP

// Get the old ImageList and then destroy it.
HIMAGELIST hOld = (HIMAGELIST)::SendMessage(m_wndToolBar, TB_GETIMAGELIST, 0, 0);
ImageList_Destroy(hOld);

// Set up image lists.
CImageList imageList;
CBitmap    bitmap;

// Create and set the toolbar image list.
bitmap.LoadBitmap(IDB_ON); <-- BITMAP IN RESOURCES
imageList.Create(16, 16, ILC_COLORDDB|ILC_MASK, 3, 1);
imageList.Add(&bitmap, RGB(255,0,255)); 

// Set the new image list on the toolbar
m_wndToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
						
// Clean up
imageList.Detach();
bitmap.DeleteObject();
// END OF ON BITMAP
///////////////////////////////////////////////////////////////////////////////////



groover4life wrote:
2) Is there a general place to find groups of generic button bitmaps or do I need to make my own?

I'm sure you can find them some where.. I usually just make my own..

Hope this helps..

Rob
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 
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 

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.