如何给一个ToolBar添加按钮?我一开始以为要自己弄几个button子窗口,并把hWndParent指定为Toolbar就好了,实际上我要照做了,后来才发现原来comctl32自带了TBBUTTON结构和TB_ADDBUTTONS消息,可是我不会加按钮。hwndtoolbar = CreateWindowEx (0,TEXT("ToolbarWindow32"), TEXT("mytoolbar"),WS_CHILD | WS_VISIBLE | WS_EX_CLIENTEDGE | TBS_TOP | TBS_HORZ | TBSTYLE_FLAT,0,0,700,50,hwnd,(HMENU)1002,((LPCREATESTRUCT)lParam)->hInstance,NULL);TBBUTTON tbb;
tbb.iBitmap = STD_FILENEW;
tbb.fsState = TBSTATE_ENABLED;
tbb.fsStyle = TBSTYLE_BUTTON;
tbb.dwData = 0; //这是啥?
tbb.iString = 0; //这是啥?
tbb.idCommand = 0; //这是啥?SendMessage (hwndtoolbar, TB_ADDBUTTONS, 20, (LPARAM)&tbb) ;
tbb.iBitmap = STD_FILENEW;
tbb.fsState = TBSTATE_ENABLED;
tbb.fsStyle = TBSTYLE_BUTTON;
tbb.dwData = 0; //这是啥?
tbb.iString = 0; //这是啥?
tbb.idCommand = 0; //这是啥?SendMessage (hwndtoolbar, TB_ADDBUTTONS, 20, (LPARAM)&tbb) ;
int iBitmap;
int idCommand;
BYTE fsState;
BYTE fsStyle;
DWORD dwData;
int iString;
} TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
typedef const TBBUTTON FAR* LPCTBBUTTON;
MembersiBitmapZero-based index of button image.idCommandCommand identifier associated with the button. This identifier is used in a WM_COMMAND message when the button is chosen. If the fsStyle member is the TBSTYLE_SEP value, this member must be zero.fsStateButton state flags. This member can be a combination of the values listed in Toolbar Button States. fsStyleButton style. This member can be a combination of values listed in Toolbar Button Styles dwDataApplication-defined value.iStringZero-based index of button string. See AlsoWM_COMMAND