Click to See Complete Forum and Search --> : c++ winapi rebar


zaryk
February 9th, 2009, 11:52 AM
Below code is used to create a rebar and toolbar. When it is created it brings up the following picture. I can then click on the rebar grip and it will look like the second picture. What do I have to do to get it to look like the second picture on creation, without clicking on the grip?


HWND Tbar(HWND slwi, HWND rebar)
{
REBARBANDINFO rbarBand;
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex);
icex.dwICC = ICC_COOL_CLASSES|ICC_BAR_CLASSES;;
InitCommonControlsEx(&icex);

TBBUTTON tbrButtons[5];

tbrButtons[0].idCommand = id_Blank;
tbrButtons[0].iBitmap = 0;
tbrButtons[0].fsState = TBSTATE_ENABLED;
tbrButtons[0].fsStyle = TBSTYLE_BUTTON;
tbrButtons[0].dwData = 0L;
tbrButtons[0].iString = 0;

tbrButtons[1].idCommand = id_Open;
tbrButtons[1].iBitmap = 0;
tbrButtons[1].fsState = TBSTATE_ENABLED;
tbrButtons[1].fsStyle = TBSTYLE_BUTTON;
tbrButtons[1].dwData = 0L;
tbrButtons[1].iString = 0;

tbrButtons[2].idCommand = id_Save;
tbrButtons[2].iBitmap = 0;
tbrButtons[2].fsState = TBSTATE_ENABLED;
tbrButtons[2].fsStyle = TBSTYLE_BUTTON;
tbrButtons[2].dwData = 0L;
tbrButtons[2].iString = 0;

tbrButtons[3].idCommand = id_SaveAll;
tbrButtons[3].iBitmap = 0;
tbrButtons[3].fsState = TBSTATE_ENABLED;
tbrButtons[3].fsStyle = TBSTYLE_BUTTON;
tbrButtons[3].dwData = 0L;
tbrButtons[3].iString = 0;

tbrButtons[4].fsStyle = TBSTYLE_SEP;
/*
tbrButtons[5].idCommand = id_Cut;
tbrButtons[5].iBitmap = 0;
tbrButtons[5].fsState = TBSTATE_ENABLED;
tbrButtons[5].fsStyle = TBSTYLE_BUTTON;
tbrButtons[5].dwData = 0L;
tbrButtons[5].iString = 0;

tbrButtons[6].idCommand = id_Copy;
tbrButtons[6].iBitmap = 0;
tbrButtons[6].fsState = TBSTATE_ENABLED;
tbrButtons[6].fsStyle = TBSTYLE_BUTTON;
tbrButtons[6].dwData = 0L;
tbrButtons[6].iString = 0;

tbrButtons[7].idCommand = id_Paste;
tbrButtons[7].iBitmap = 0;
tbrButtons[7].fsState = TBSTATE_ENABLED;
tbrButtons[7].fsStyle = TBSTYLE_BUTTON;
tbrButtons[7].dwData = 0L;
tbrButtons[7].iString = 0;

tbrButtons[8].fsStyle = TBSTYLE_SEP;

tbrButtons[9].idCommand = id_Undo;
tbrButtons[9].iBitmap = 0;
tbrButtons[9].fsState = TBSTATE_ENABLED;
tbrButtons[9].fsStyle = TBSTYLE_BUTTON;
tbrButtons[9].dwData = 0L;
tbrButtons[9].iString = 0;

tbrButtons[10].idCommand = id_Redo;
tbrButtons[10].iBitmap = 0;
tbrButtons[10].fsState = TBSTATE_ENABLED;
tbrButtons[10].fsStyle = TBSTYLE_BUTTON;
tbrButtons[10].dwData = 0L;
tbrButtons[10].iString = 0;

tbrButtons[11].fsStyle = TBSTYLE_SEP;

tbrButtons[12].idCommand = id_Find;
tbrButtons[12].iBitmap = 0;
tbrButtons[12].fsState = TBSTATE_ENABLED;
tbrButtons[12].fsStyle = TBSTYLE_BUTTON;
tbrButtons[12].dwData = 0L;
tbrButtons[12].iString = 0;
*/

stndTbar = CreateToolbarEx(slwi,
WS_CHILD | WS_BORDER | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_NORESIZE | WS_VISIBLE,
id_Toolbar,
5,
(HINSTANCE)hInst,
id_Toolbar,
(LPCTBBUTTON)&tbrButtons,
5,
15,15, // width & height of buttons
16,16, // width & height of bitmaps
sizeof(TBBUTTON));

if (stndTbar == NULL )
{
MessageBox (NULL, TEXT("Toolbar not created!"), NULL, MB_OK );
return (HWND)NULL;
}

// Initialize REBARBANDINFO for all coolbar bands.
rbarBand.cbSize = sizeof(REBARBANDINFO);
rbarBand.fMask = RBBIM_COLORS | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID | RBBIM_SIZE;
rbarBand.clrFore = GetSysColor(COLOR_BTNTEXT);
rbarBand.clrBack = GetSysColor(COLOR_BTNFACE);
rbarBand.fStyle = RBBS_CHILDEDGE | RBBS_NOVERT | RBBS_GRIPPERALWAYS | RBBS_VARIABLEHEIGHT;
rbarBand.hwndChild = stndTbar;
rbarBand.wID = id_Toolbar;
rbarBand.cxMinChild = 22;
rbarBand.cyMinChild = 22;

// Insert band into coolbar.
SendMessage(rebar, RB_INSE*****D, (UINT) -1,
(LPARAM)(LPREBARBANDINFO)&rbarBand);

return stndTbar;
}


void Rbar::CrtRbar(HWND slwi)
{

int rbarImg;
REBARINFO rbarInfo;
HIMAGELIST rbarHIML;
HBITMAP rbarBMP;

INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex);
icex.dwICC = ICC_COOL_CLASSES;
InitCommonControlsEx(&icex);

// Create the image list.
rbarHIML = ImageList_Create (16, 16, 0, 1, 0);

rbarBMP = LoadBitmap (hInst, MAKEINTRESOURCE (id_ToolbarBitmap));
rbarImg = ImageList_Add (rbarHIML, rbarBMP, NULL);

rebar = CreateWindowEx(0L, REBARCLASSNAME, NULL,
WS_VISIBLE | WS_BORDER | WS_CHILD | WS_CLIPCHILDREN |
WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NOPARENTALIGN |
RBS_VARHEIGHT | RBS_BANDBORDERS,
2, 2, 400, 100,
slwi,
(HMENU)id_Rbar,
hInst,
NULL );

if (!rebar)
{
return;
}

rbarInfo.cbSize = sizeof(rbarInfo);
rbarInfo.fMask = RBIM_IMAGELIST;
rbarInfo.himl = rbarHIML;
SendMessage(rebar, RB_SETBARINFO, 0L, (LPARAM)&rbarInfo);

HWND altBar = Tbar(slwi, rebar);
}

zaryk
February 10th, 2009, 05:31 PM
I fixed last post problem. I removed novert and variableheight from rebarbandinfo. Note: Changed some variables and HWND names since last post. Now trying to add 2 toolbars.

problem 1: Pic1 is result at creation.
problem 2: Pic2 is result after single clicking on the grip of toolbar 2.
problem 3: Pic3 is result after moving toolbar 2.

Can't seem to change the width of the rebar so when I move the toolbars, it doesn't result in problem 3. (Hiding part of toolbar2)


EDIT: novert actually had no effect in solving first post. As for problem 2, it does not matter if I single click 1st toolbar grip or 2nd toolbar grip as a result 2nd toolbar grip moves back and forth as if toggled from show to hide and from hide to show. It's kinda cool, but not the result I am looking for.


HWND SFileTbar(HWND slwi, HWND rebar)
{
REBARBANDINFO rbarBand;
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex);
icex.dwICC = ICC_COOL_CLASSES|ICC_BAR_CLASSES;;
InitCommonControlsEx(&icex);

TBBUTTON tbrButtons[4];

tbrButtons[0].idCommand = id_Blank;
tbrButtons[0].iBitmap = 0;
tbrButtons[0].fsState = TBSTATE_ENABLED;
tbrButtons[0].fsStyle = TBSTYLE_BUTTON;
tbrButtons[0].dwData = 0L;
tbrButtons[0].iString = 0;

tbrButtons[1].idCommand = id_Open;
tbrButtons[1].iBitmap = 0;
tbrButtons[1].fsState = TBSTATE_ENABLED;
tbrButtons[1].fsStyle = TBSTYLE_BUTTON;
tbrButtons[1].dwData = 0L;
tbrButtons[1].iString = 0;

tbrButtons[2].idCommand = id_Save;
tbrButtons[2].iBitmap = 0;
tbrButtons[2].fsState = TBSTATE_ENABLED;
tbrButtons[2].fsStyle = TBSTYLE_BUTTON;
tbrButtons[2].dwData = 0L;
tbrButtons[2].iString = 0;

tbrButtons[3].idCommand = id_SaveAll;
tbrButtons[3].iBitmap = 0;
tbrButtons[3].fsState = TBSTATE_ENABLED;
tbrButtons[3].fsStyle = TBSTYLE_BUTTON;
tbrButtons[3].dwData = 0L;
tbrButtons[3].iString = 0;

sFileTbar = CreateToolbarEx(slwi,
WS_CHILD | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_NORESIZE | WS_VISIBLE,
id_sEditTb,
4,
(HINSTANCE)hInst,
id_sEditTb,
(LPCTBBUTTON)&tbrButtons,
4,
15,15, // width & height of buttons
16,16, // width & height of bitmaps
sizeof(TBBUTTON));

if (sFileTbar == NULL )
{
MessageBox (NULL, TEXT("Toolbar not created!"), NULL, MB_OK );
return (HWND)NULL;
}

// Initialize REBARBANDINFO for all coolbar bands.
rbarBand.cbSize = sizeof(REBARBANDINFO);
rbarBand.fMask = RBBIM_COLORS | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID;
rbarBand.clrFore = GetSysColor(COLOR_BTNTEXT);
rbarBand.clrBack = GetSysColor(COLOR_BTNFACE);
rbarBand.fStyle = RBBS_CHILDEDGE | RBBS_GRIPPERALWAYS;
rbarBand.hwndChild = sFileTbar;
rbarBand.wID = id_sEditTb;
rbarBand.cxMinChild = 90;
rbarBand.cyMinChild = 22;

// Insert band into coolbar.
SendMessage(rebar, RB_INSE*****D, (UINT) -1,
(LPARAM)(LPREBARBANDINFO)&rbarBand);

return sFileTbar;
}

HWND SEditTbar(HWND slwi, HWND rebar)
{
REBARBANDINFO rbarBand;
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex);
icex.dwICC = ICC_COOL_CLASSES|ICC_BAR_CLASSES;;
InitCommonControlsEx(&icex);

TBBUTTON tbrButtons[8];

tbrButtons[0].idCommand = id_Cut;
tbrButtons[0].iBitmap = 0;
tbrButtons[0].fsState = TBSTATE_ENABLED;
tbrButtons[0].fsStyle = TBSTYLE_BUTTON;
tbrButtons[0].dwData = 0L;
tbrButtons[0].iString = 0;

tbrButtons[1].idCommand = id_Copy;
tbrButtons[1].iBitmap = 0;
tbrButtons[1].fsState = TBSTATE_ENABLED;
tbrButtons[1].fsStyle = TBSTYLE_BUTTON;
tbrButtons[1].dwData = 0L;
tbrButtons[1].iString = 0;

tbrButtons[2].idCommand = id_Paste;
tbrButtons[2].iBitmap = 0;
tbrButtons[2].fsState = TBSTATE_ENABLED;
tbrButtons[2].fsStyle = TBSTYLE_BUTTON;
tbrButtons[2].dwData = 0L;
tbrButtons[2].iString = 0;

tbrButtons[3].fsStyle = TBSTYLE_SEP;

tbrButtons[4].idCommand = id_Undo;
tbrButtons[4].iBitmap = 0;
tbrButtons[4].fsState = TBSTATE_ENABLED;
tbrButtons[4].fsStyle = TBSTYLE_BUTTON;
tbrButtons[4].dwData = 0L;
tbrButtons[4].iString = 0;

tbrButtons[5].idCommand = id_Redo;
tbrButtons[5].iBitmap = 0;
tbrButtons[5].fsState = TBSTATE_ENABLED;
tbrButtons[5].fsStyle = TBSTYLE_BUTTON;
tbrButtons[5].dwData = 0L;
tbrButtons[5].iString = 0;

tbrButtons[6].fsStyle = TBSTYLE_SEP;

tbrButtons[7].idCommand = id_Find;
tbrButtons[7].iBitmap = 0;
tbrButtons[7].fsState = TBSTATE_ENABLED;
tbrButtons[7].fsStyle = TBSTYLE_BUTTON;
tbrButtons[7].dwData = 0L;
tbrButtons[7].iString = 0;


sEditTbar = CreateToolbarEx(slwi,
WS_CHILD | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_NORESIZE | WS_VISIBLE,
id_sEditTb,
8,
(HINSTANCE)hInst,
id_sEditTb,
(LPCTBBUTTON)&tbrButtons,
8,
15,15, // width & height of buttons
16,16, // width & height of bitmaps
sizeof(TBBUTTON));

if (sEditTbar == NULL )
{
MessageBox (NULL, TEXT("Toolbar not created!"), NULL, MB_OK );
return (HWND)NULL;
}

// Initialize REBARBANDINFO for all coolbar bands.
rbarBand.cbSize = sizeof(REBARBANDINFO);
rbarBand.fMask = RBBIM_COLORS | RBBIM_CHILD | RBBIM_STYLE | RBBIM_ID;
rbarBand.clrFore = GetSysColor(COLOR_BTNTEXT);
rbarBand.clrBack = GetSysColor(COLOR_BTNFACE);
rbarBand.fStyle = RBBS_CHILDEDGE | RBBS_GRIPPERALWAYS;
rbarBand.hwndChild = sEditTbar;
rbarBand.wID = id_sEditTb;
rbarBand.cxMinChild = 125;
rbarBand.cyMinChild = 22;

// Insert band into coolbar.
SendMessage(rebar, RB_INSE*****D, (UINT) -1,
(LPARAM)(LPREBARBANDINFO)&rbarBand);

return sEditTbar;
}

void Rbar::CrtRbar(HWND slwi)
{

int rbarImg;
REBARINFO rbarInfo;
HIMAGELIST rbarHIML;
HBITMAP rbarBMP;

INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex);
icex.dwICC = ICC_COOL_CLASSES;
InitCommonControlsEx(&icex);

// Create the image list.
rbarHIML = ImageList_Create (16, 16, 0, 1, 0);

rbarBMP = LoadBitmap (hInst, MAKEINTRESOURCE (id_ToolbarBitmap));
rbarImg = ImageList_Add (rbarHIML, rbarBMP, NULL);

rebar = CreateWindowEx(0L, REBARCLASSNAME, NULL,
WS_VISIBLE | WS_CHILD | WS_BORDER| WS_CLIPCHILDREN |
WS_CLIPSIBLINGS | CCS_NODIVIDER |
RBS_VARHEIGHT,
2, 2, 1000, 0,
slwi,
(HMENU)id_Rbar,
hInst,
NULL );

if (!rebar)
{
return;
}

rbarInfo.cbSize = sizeof(rbarInfo);
rbarInfo.fMask = RBIM_IMAGELIST;
rbarInfo.himl = rbarHIML;
SendMessage(rebar, RB_SETBARINFO, 0L, (LPARAM)&rbarInfo);

HWND FaltBar = SFileTbar(slwi, rebar);
HWND SaltBar = SEditTbar(slwi, rebar);
}

zaryk
February 17th, 2009, 10:02 PM
Got it working correctly. While I was changing variables I forgot to change the "id_sEditTb" variables in below to "id_sFileTb" and I added "RBBIM_CHILDSIZE" to the second toolbars rebarbandinfo:

Now Time to add some bitmap to the toolbars.


CreateToolbarEx(slwi,
WS_CHILD | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_NORESIZE | WS_VISIBLE,
id_sEditTb,
4,
(HINSTANCE)hInst,
id_sEditTb,
(LPCTBBUTTON)&tbrButtons,
4,
15,15, // width & height of buttons
16,16, // width & height of bitmaps
sizeof(TBBUTTON));





Complete without bitmap: Be Happy.


HWND SFileTbar(HWND slwi, HWND rebar)
{
REBARBANDINFO rbarBand;

TBBUTTON tbrButtons[4];

tbrButtons[0].idCommand = id_Blank;
tbrButtons[0].iBitmap = 0;
tbrButtons[0].fsState = TBSTATE_ENABLED;
tbrButtons[0].fsStyle = TBSTYLE_BUTTON;
tbrButtons[0].dwData = 0L;
tbrButtons[0].iString = 0;

tbrButtons[1].idCommand = id_Open;
tbrButtons[1].iBitmap = 0;
tbrButtons[1].fsState = TBSTATE_ENABLED;
tbrButtons[1].fsStyle = TBSTYLE_BUTTON;
tbrButtons[1].dwData = 0L;
tbrButtons[1].iString = 0;

tbrButtons[2].idCommand = id_Save;
tbrButtons[2].iBitmap = 0;
tbrButtons[2].fsState = TBSTATE_ENABLED;
tbrButtons[2].fsStyle = TBSTYLE_BUTTON;
tbrButtons[2].dwData = 0L;
tbrButtons[2].iString = 0;

tbrButtons[3].idCommand = id_SaveAll;
tbrButtons[3].iBitmap = 0;
tbrButtons[3].fsState = TBSTATE_ENABLED;
tbrButtons[3].fsStyle = TBSTYLE_BUTTON;
tbrButtons[3].dwData = 0L;
tbrButtons[3].iString = 0;

CreateToolbarEx(slwi,
WS_CHILD | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_NORESIZE | WS_VISIBLE,
id_sFileTb,
4,
(HINSTANCE)hInst,
id_sFileTb,
(LPCTBBUTTON)&tbrButtons,
4,
15,15, // width & height of buttons
16,16, // width & height of bitmaps
sizeof(TBBUTTON));

if (GetDlgItem(slwi, id_sFileTb) == NULL )
{
MessageBox (NULL, TEXT("Toolbar not created!"), NULL, MB_OK );
return (HWND)NULL;
}

// Initialize REBARBANDINFO for all coolbar bands.
rbarBand.cbSize = sizeof(REBARBANDINFO);
rbarBand.fMask = RBBIM_COLORS | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID;
rbarBand.clrFore = GetSysColor(COLOR_BTNTEXT);
rbarBand.clrBack = GetSysColor(COLOR_BTNFACE);
rbarBand.fStyle = RBBS_CHILDEDGE | RBBS_GRIPPERALWAYS;
RECT rc={0};
rbarBand.hwndChild = GetDlgItem(slwi, id_sFileTb);
rbarBand.cyChild = 90;
rbarBand.cxMinChild = 90;
rbarBand.cyMinChild = 22;
rbarBand.cx = 0;

// Insert band into coolbar.
SendMessage(GetDlgItem(slwi, id_Rbar), RB_INSE*****D, (UINT) -1,
(LPARAM)(LPREBARBANDINFO)&rbarBand);

return GetDlgItem(slwi, id_sFileTb);
}

HWND SEditTbar(HWND slwi, HWND rebar)
{
REBARBANDINFO rbarBand;

TBBUTTON tbrButtons[8];

tbrButtons[0].idCommand = id_Cut;
tbrButtons[0].iBitmap = 0;
tbrButtons[0].fsState = TBSTATE_ENABLED;
tbrButtons[0].fsStyle = TBSTYLE_BUTTON;
tbrButtons[0].dwData = 0L;
tbrButtons[0].iString = 0;

tbrButtons[1].idCommand = id_Copy;
tbrButtons[1].iBitmap = 0;
tbrButtons[1].fsState = TBSTATE_ENABLED;
tbrButtons[1].fsStyle = TBSTYLE_BUTTON;
tbrButtons[1].dwData = 0L;
tbrButtons[1].iString = 0;

tbrButtons[2].idCommand = id_Paste;
tbrButtons[2].iBitmap = 0;
tbrButtons[2].fsState = TBSTATE_ENABLED;
tbrButtons[2].fsStyle = TBSTYLE_BUTTON;
tbrButtons[2].dwData = 0L;
tbrButtons[2].iString = 0;

tbrButtons[3].fsStyle = TBSTYLE_SEP;

tbrButtons[4].idCommand = id_Undo;
tbrButtons[4].iBitmap = 0;
tbrButtons[4].fsState = TBSTATE_ENABLED;
tbrButtons[4].fsStyle = TBSTYLE_BUTTON;
tbrButtons[4].dwData = 0L;
tbrButtons[4].iString = 0;

tbrButtons[5].idCommand = id_Redo;
tbrButtons[5].iBitmap = 0;
tbrButtons[5].fsState = TBSTATE_ENABLED;
tbrButtons[5].fsStyle = TBSTYLE_BUTTON;
tbrButtons[5].dwData = 0L;
tbrButtons[5].iString = 0;

tbrButtons[6].fsStyle = TBSTYLE_SEP;

tbrButtons[7].idCommand = id_Find;
tbrButtons[7].iBitmap = 0;
tbrButtons[7].fsState = TBSTATE_ENABLED;
tbrButtons[7].fsStyle = TBSTYLE_BUTTON;
tbrButtons[7].dwData = 0L;
tbrButtons[7].iString = 0;


CreateToolbarEx(slwi,
WS_CHILD | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_NORESIZE | WS_VISIBLE,
id_sEditTb,
8,
(HINSTANCE)hInst,
id_sEditTb,
(LPCTBBUTTON)&tbrButtons,
8,
15,15, // width & height of buttons
16,16, // width & height of bitmaps
sizeof(TBBUTTON));

if (GetDlgItem(slwi, id_sEditTb) == NULL )
{
MessageBox (NULL, TEXT("Toolbar not created!"), NULL, MB_OK );
return (HWND)NULL;
}

// Initialize REBARBANDINFO for all coolbar bands.
rbarBand.cbSize = sizeof(REBARBANDINFO);
rbarBand.fMask = RBBIM_COLORS | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID;
rbarBand.clrFore = GetSysColor(COLOR_BTNTEXT);
rbarBand.clrBack = GetSysColor(COLOR_BTNFACE);
rbarBand.fStyle = RBBS_CHILDEDGE | RBBS_GRIPPERALWAYS;
rbarBand.hwndChild = GetDlgItem(slwi, id_sEditTb);
rbarBand.cxMinChild = 125;
rbarBand.cyMinChild = 22;

// Insert band into coolbar.
SendMessage(GetDlgItem(slwi, id_Rbar), RB_INSE*****D, (UINT) -1,
(LPARAM)(LPREBARBANDINFO)&rbarBand);

return GetDlgItem(slwi, id_sEditTb);

}


void Load::CrtRbar(HWND slwi)
{

int rbarImg;
REBARINFO rbarInfo;
HIMAGELIST rbarHIML;
HBITMAP rbarBMP;

// Create the image list.
rbarHIML = ImageList_Create (16, 16, 0, 1, 0);

rbarBMP = LoadBitmap (hInst, MAKEINTRESOURCE (id_ToolbarBitmap));
rbarImg = ImageList_Add (rbarHIML, rbarBMP, NULL);

CreateWindowEx(0L, REBARCLASSNAME, NULL,
WS_VISIBLE | WS_CHILD | WS_BORDER |
CCS_NODIVIDER,
2, 2, 1000, 30,
slwi,
(HMENU)id_Rbar,
hInst,
NULL );

if (!GetDlgItem(slwi, id_Rbar))
{
return;
}

rbarInfo.cbSize = sizeof(rbarInfo);
rbarInfo.fMask = RBIM_IMAGELIST;
rbarInfo.himl = rbarHIML;
SendMessage(GetDlgItem(slwi, id_Rbar), RB_SETBARINFO, 0L, (LPARAM)&rbarInfo);

HWND sAlt = SFileTbar(slwi, GetDlgItem(slwi, id_sFileTb));
HWND fAlt = SEditTbar(slwi, GetDlgItem(slwi, id_sEditTb));
}