Erreur : Importer un bitmap dans une toolbar [win32]
julien_boss
Messages postés
165
Date d'inscription
samedi 4 juin 2005
Statut
Membre
Dernière intervention
24 octobre 2007
-
10 mars 2007 à 22:47
julien_boss
Messages postés
165
Date d'inscription
samedi 4 juin 2005
Statut
Membre
Dernière intervention
24 octobre 2007
-
13 mars 2007 à 20:38
Bonjour, mon probleme est que les icones de ma barre d'icones sont toutes noires ... :/
Voici le code qui crée la toolbar :
void InitToolbar(HWND hwnd)
{
HWND hToolBar;
TBADDBITMAP tbab;
TBBUTTON tbb[9];
hToolBar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD|WS_VISIBLE|TBSTYLE_TOOLTIPS,
0, 0, 0, 0, hwnd, (HMENU)ID_TOOLBAR, hTInst, NULL);
if(!hToolBar)
SendMessage(hwnd, WM_DESTROY, 0, 0);
SendMessage(hToolBar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hToolBar, TB_SETBITMAPSIZE, 0, MAKELONG(16,16));
SendMessage(hToolBar, TB_SETBUTTONSIZE, 0,MAKELONG(23,22));
tbab.hInst = hTInst;
tbab.nID = IDB_TOOLS;
SendMessage(hToolBar, TB_ADDBITMAP, 6, (LPARAM)&tbab);
ZeroMemory(tbb, sizeof(tbb));
tbb[0].iBitmap = 0;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
tbb[0].idCommand = IDM_FNOUVEAU;
tbb[1].iBitmap = 1;
tbb[1].fsState = TBSTATE_ENABLED;
tbb[1].fsStyle = TBSTYLE_BUTTON;
tbb[1].idCommand = IDM_FOPEN;
tbb[2].fsStyle = TBSTYLE_SEP;
tbb[3].iBitmap = 2;
tbb[3].fsState = TBSTATE_ENABLED;
tbb[3].fsStyle = TBSTYLE_BUTTON;
tbb[3].idCommand = IDM_FCLOSE;
tbb[4].fsStyle = TBSTYLE_SEP;
tbb[5].iBitmap = 3;
tbb[5].fsState = TBSTATE_ENABLED;
tbb[5].fsStyle = TBSTYLE_BUTTON;
tbb[5].idCommand = IDM_ENAJOUT;
tbb[6].iBitmap = 4;
tbb[6].fsState = TBSTATE_ENABLED;
tbb[6].fsStyle = TBSTYLE_BUTTON;
tbb[6].idCommand = IDM_ENSUPP;
tbb[7].fsStyle = TBSTYLE_SEP;
tbb[8].iBitmap = 5;
tbb[8].fsState = TBSTATE_ENABLED;
tbb[8].fsStyle = TBSTYLE_BUTTON;
tbb[8].idCommand = IDM_AABOUT;
//Initialisation des icones de la barre d'icone
SendMessage(hToolBar, TB_ADDBUTTONS, 9, (LPARAM)&tbb);
}
la ressource IDB_TOOLS est définie ainsi :
IDB_TOOLS BITMAP "res/tools.bmp"
J'ai comparé mon code avec 3 autres sources où les toolbar s'affichent parfaitement, et tout coincidait, pourtant mes icones restent noires :/
je n'ai aucun message d'erreur dans mon compilateur (dev-cpp), et mon image est un bitmap de 96*16, de 24bits (je ne sais pas si c'est utile à savoir, m'enfin sait on jms ...)
Merci de votre attention