Click here to Skip to main content
15,891,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
hWndToolbar = CreateToolbarEx(m_hWnd,
		                      WS_CHILD|WS_VISIBLE|CCS_ADJUSTABLE|WS_BORDER|CBRS_ALIGN_LEFT|TBSTYLE_TRANSPARENT,
	                              IDR_TOOLBAR1,
	                              NUMBUTTONS,
				           NULL,
			              IDR_TOOLBAR1,
				      tbrButtons,
				      NUMBUTTONS,
				     16, 16, 16,16,
				      sizeof(TBBUTTON));
HBITMAP hbm = CreateMappedBitmap(NULL, IDB_PAN, 0, &colorMap, 1);

TBADDBITMAP tb;
tb.hInst = NULL;
tb.nID = (UINT_PTR)hbm;
::SendMessage (hWndToolbar, TB_ADDBITMAP, 0, (LPARAM)&tb);
HBITMAP hbm2=CreateMappedBitmap(NULL, IDB_ZOOMPLUS,0, &colorMap, 1);
TBADDBITMAP tb1;
tb1.hInst = NULL;
tb1.nID = (UINT_PTR)hbm2;
::SendMessage (hWndToolbar, TB_ADDBITMAP, 0, (LPARAM)&tb1);
HBITMAP hbm3=CreateMappedBitmap(NULL, IDB_ZOOMMIN,0, &colorMap, 1);
TBADDBITMAP tb2;
tb2.hInst = NULL;
tb2.nID = (UINT_PTR)hbm3;
::SendMessage (hWndToolbar, TB_ADDBITMAP, 0, (LPARAM)&tb2);




this is working in sample aplication.when i try my project Cretemap bitmap is not loaded.
any one can help me
Posted
Updated 22-Jun-11 23:39pm
v2
Comments
Manfred Rudolf Bihy 23-Jun-11 5:40am    
More details please as to what your exact error or application malfunction is, please.
Himansu sekhar bal 23-Jun-11 5:45am    
i want to load icon like(zoom,hand)into a toolbar.i use createex not working on my application.then after i try for createtoolbarex functionality that is working.but bmp map is not working


Use GetLastError to check the error while using CreateMappedBitmap.

GetLastError ->[^]
 
Share this answer
 
The bitmap cannot be greater that 256 colors (8 bit). You might want to try a lower res bitmap and see if it works.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900