HerbDX
October 17th, 2004, 09:15 AM
Sorry this may sound a bit stupid, but i'm having trouble adding buttons to my toolbar, it appears fine with this code:
rdPtr->hWndTBX = CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
WS_CHILD | CCS_ADJUSTABLE | WS_VISIBLE,
rdPtr->rHo.hoX - rhPtr->rhWindowX,
rdPtr->rHo.hoY - rhPtr->rhWindowY,
rdPtr->rHo.hoImgWidth,
rdPtr->rHo.hoImgHeight,
ryPtr->ryHeditWin,
NULL,
rhPtr->rh4.rh4Instance,
NULL);
But then in my function when I try and add a button:
short WINAPI DLLExport AddButton(LPRDATA rdPtr, long param1, long param2)
{
char pszBuf[128];
memcpy(pszBuf,(const void *)param2,127);
TBBUTTON tbb[1];
// Send the TB_BUTTONSTRUCTSIZE message, which is required for
// backward compatibility.
SendMessage(rdPtr->hWndTBX, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);
tbb[0].iBitmap = 0;
tbb[0].idCommand = NULL;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_SEP;
tbb[0].dwData = 0;
tbb[0].iString = (int) pszBuf; // Text is in a buffer.
SendMessage(rdPtr->hWndTBX, TB_ADDBUTTONS, 1, (LPARAM) (LPTBBUTTON) &tbb);
SendMessage(rdPtr->hWndTBX, TB_AUTOSIZE, 0, 0);
return 0;
}
Absolutely nothing happens, i've messageboxed the ADDBUTTONS message and it returns true, so in theory it should show up, but it doesn't
Thanks
rdPtr->hWndTBX = CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
WS_CHILD | CCS_ADJUSTABLE | WS_VISIBLE,
rdPtr->rHo.hoX - rhPtr->rhWindowX,
rdPtr->rHo.hoY - rhPtr->rhWindowY,
rdPtr->rHo.hoImgWidth,
rdPtr->rHo.hoImgHeight,
ryPtr->ryHeditWin,
NULL,
rhPtr->rh4.rh4Instance,
NULL);
But then in my function when I try and add a button:
short WINAPI DLLExport AddButton(LPRDATA rdPtr, long param1, long param2)
{
char pszBuf[128];
memcpy(pszBuf,(const void *)param2,127);
TBBUTTON tbb[1];
// Send the TB_BUTTONSTRUCTSIZE message, which is required for
// backward compatibility.
SendMessage(rdPtr->hWndTBX, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);
tbb[0].iBitmap = 0;
tbb[0].idCommand = NULL;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_SEP;
tbb[0].dwData = 0;
tbb[0].iString = (int) pszBuf; // Text is in a buffer.
SendMessage(rdPtr->hWndTBX, TB_ADDBUTTONS, 1, (LPARAM) (LPTBBUTTON) &tbb);
SendMessage(rdPtr->hWndTBX, TB_AUTOSIZE, 0, 0);
return 0;
}
Absolutely nothing happens, i've messageboxed the ADDBUTTONS message and it returns true, so in theory it should show up, but it doesn't
Thanks