工具栏由CreateToolbarEx创建。《win32程序员参考》,对CreateToolbarEx有如下叙述:HWND CreateToolbarEx(HWND hwnd, DWORD ws, UINT wID, int nBitmaps, HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons, int iNumButtons, int dxButton, int dyButton, int dxBitmap, int dyBitmap, UINT uStructSize );hwnd: Handle of the parent window ws: The toolbar window style wID: Control ID for the toolbar nBitmaps: Number of button images in the resource bitmap hBMInst: Instance handle of the aplication that contains the button resource image wBMID: Resource ID of the buttons bitmap lpButtons: Pointer to an array of TBBUTTON structures dxButton/dyButton: Width and height of the buttons on the toolbar dxBitmap/dyBitmap: Width and height of the images on the buttons.Hwnd:父窗口的句柄。 ws:工具栏窗口的样式。 wID:工具栏的控件ID。 nBitmaps:在位图资源中的按钮图片数。 hBMInst:程序的实例句柄。其中包含有按钮图片资源。 wBMID:按钮位图的资源ID。 lpButtons:指向TBBUTTON结构的数组的指针。 dxButton/dyButton:工具栏上的按钮的长和宽。 dxBitmap/dyBitmap:工具栏上的图片的长和宽。
DWORD ws,
UINT wID,
int nBitmaps,
HINSTANCE hBMInst,
UINT wBMID,
LPCTBBUTTON lpButtons,
int iNumButtons,
int dxButton,
int dyButton,
int dxBitmap,
int dyBitmap,
UINT uStructSize
);hwnd: Handle of the parent window
ws: The toolbar window style
wID: Control ID for the toolbar
nBitmaps: Number of button images in the resource bitmap
hBMInst: Instance handle of the aplication that contains the button resource image
wBMID: Resource ID of the buttons bitmap
lpButtons: Pointer to an array of TBBUTTON structures
dxButton/dyButton: Width and height of the buttons on the toolbar
dxBitmap/dyBitmap: Width and height of the images on the buttons.Hwnd:父窗口的句柄。
ws:工具栏窗口的样式。
wID:工具栏的控件ID。
nBitmaps:在位图资源中的按钮图片数。
hBMInst:程序的实例句柄。其中包含有按钮图片资源。
wBMID:按钮位图的资源ID。
lpButtons:指向TBBUTTON结构的数组的指针。
dxButton/dyButton:工具栏上的按钮的长和宽。
dxBitmap/dyBitmap:工具栏上的图片的长和宽。
hWndRebar = CreateWindowEx(
0L,
REBARCLASSNAME,
NULL,
WS_VISIBLE | WS_BORDER | WS_CHILD | WS_CLIPCHILDREN |
WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NOPARENTALIGN |
RBS_VARHEIGHT | RBS_BANDBORDERS,
0, 0, 400, 275,
hWndParent,
(HMENU)ID_REBAR,
hInst,
NULL );