From: Nhat Dung on
I can't see anything when run the Rebar example of MS-SDK (just see the menu
only and nothing else)
Because of that I write a simple rebar but I can't see anything too

All those function is take from Windows SDK
// take from
HWND CreateSimpleToolbar(HWND hWndParent)
{
// Define some constants.
const int ImageListID = 0;
const int numButtons = 3;
const DWORD buttonStyles = BTNS_AUTOSIZE;
const int bitmapSize = 16;

// Create the toolbar.
HWND hWndToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
//WS_CHILD | TBSTYLE_WRAPABLE,
WS_CHILD|WS_VISIBLE|TBSTYLE_FLAT|CCS_NOPARENTALIGN|CCS_NORESIZE|CCS_NODIVIDER,
0, 0, 0, 0,
hWndParent, NULL, g_hInst, NULL);
if (hWndToolbar == NULL)
{
return NULL;
}

// Create the imagelist.
HIMAGELIST hImageList = ImageList_Create(
bitmapSize, bitmapSize, // Dimensions of individual bitmaps.
ILC_COLOR16 | ILC_MASK, // Ensures transparent background.
numButtons, 0);

// Set the image list.
SendMessage(hWndToolbar, TB_SETIMAGELIST, (WPARAM)ImageListID,
(LPARAM)hImageList);

// Load the button images.
SendMessage(hWndToolbar, TB_LOADIMAGES, (WPARAM)IDB_STD_SMALL_COLOR,
(LPARAM)HINST_COMMCTRL);

// Initialize button info.
// IDM_NEW, IDM_OPEN, and IDM_SAVE are application-defined command
constants.
TBBUTTON tbButtons[numButtons] =
{
{ MAKELONG(STD_FILENEW, ImageListID), 1, TBSTATE_ENABLED,
buttonStyles, {0}, 0, (INT_PTR)L"New" },
{ MAKELONG(STD_FILEOPEN, ImageListID), 2, TBSTATE_ENABLED,
buttonStyles, {0}, 0, (INT_PTR)L"Open"},
{ MAKELONG(STD_FILESAVE, ImageListID), 3, 0,
buttonStyles, {0}, 0, (INT_PTR)L"Save"}
};

// Add buttons.
SendMessage(hWndToolbar, TB_BUTTONSTRUCTSIZE,
(WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hWndToolbar, TB_ADDBUTTONS, (WPARAM)numButtons,
(LPARAM)&tbButtons);

// Tell the toolbar to resize itself, and show it.
SendMessage(hWndToolbar, TB_AUTOSIZE, 0, 0);
ShowWindow(hWndToolbar, TRUE);
return hWndToolbar;
}

HWND CreateComboBox(HWND hWndParent)
{
HWND hcombo = CreateWindowW(L"COMBOBOX", L"aaa", WS_VISIBLE | WS_CHILD |
CBS_DROPDOWNLIST | WS_VSCROLL | CBS_HASSTRINGS | CBS_AUTOHSCROLL
, 50, 50, 100, 33, hWndParent, 0, g_hInst, 0);
return hcombo;
}

HWND WINAPI CreateRebar(HWND hwndOwner, HWND hwndToolbar, HWND hwndCombo)
{
// Check parameters.
if ((hwndToolbar == NULL) || (hwndCombo == NULL))
{
return NULL;
}

// Initialize common controls.
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES;
InitCommonControlsEx(&icex);

// Create the rebar.
HWND hwndRebar = CreateWindowEx(WS_EX_TOOLWINDOW,
REBARCLASSNAME,
NULL,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | RBS_VARHEIGHT |
CCS_NODIVIDER | RBS_BANDBORDERS,
0,0,100,100,
hwndOwner,
NULL,
g_hInst,
NULL);

return hwndRebar;
if(!hwndRebar)
{
return NULL;
}

// Initialize band info used by both bands.
REBARBANDINFO rbBand = { sizeof(REBARBANDINFO) };
rbBand.fMask =
RBBIM_STYLE // fStyle is valid.
| RBBIM_TEXT // lpText is valid.
| RBBIM_CHILD // hwndChild is valid.
| RBBIM_CHILDSIZE // child size members are valid.
| RBBIM_SIZE; // cx is valid
rbBand.fStyle = RBBS_CHILDEDGE | RBBS_GRIPPERALWAYS; //RBBS_FIXEDSIZE |

// Get the height of the toolbar.
DWORD dwBtnSize = (DWORD)SendMessage(hwndToolbar, TB_GETBUTTONSIZE, 0,0);

// Set values unique to the band with the toolbar.
rbBand.lpText = TEXT("");
rbBand.hwndChild = hwndToolbar;
rbBand.cyChild = LOWORD(dwBtnSize);
rbBand.cxMinChild = 3 * HIWORD(dwBtnSize);
rbBand.cyMinChild = LOWORD(dwBtnSize);
// The default width is the width of the buttons.
rbBand.cx = 0;

// Add the band that has the toolbar.
SendMessage(hwndRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

// Set values unique to the band with the combo box.
RECT rc;
GetWindowRect(hwndCombo, &rc);
rbBand.lpText = TEXT("Font");
rbBand.hwndChild = hwndCombo;
rbBand.cxMinChild = 0;
rbBand.cyMinChild = rc.bottom - rc.top;
// The default width should be set to some value wider than the text. The
combo
// box itself will expand to fill the band.
rbBand.cx = 100;

// Add the band that has the combo box.
SendMessage(hwndRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

return (hwndRebar);
}

and I call CreateRebar(hWnd, CreateSimpleToolbar(hWnd),
CreateComboBox(hWnd)); on WM_CREATE

can someone tell me what wrong ? The result is a toolbar & a combobox with
no rebar

From: Timo Kunze on
Nhat Dung schrieb:
> ShowWindow(hWndToolbar, TRUE);
You're usage of ShowWindow is wrong.
http://msdn.microsoft.com/en-us/library/ms633548.aspx

But that's not the real problem. I'm not sure what the real problem is,
but you return from CreateRebar before you add any bands. I'm not sure a
rebar displays anything if it doesn't contain any bands.

Timo
--
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
"Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
demokratischem Wege – durchsetzen."
From: Nhat Dung on
I'm using like Microsoft does:
Using Toolbar Controls
http://msdn.microsoft.com/en-us/library/bb760446%28VS.85%29.aspx
(SW_SHOWNORMAL = 1)

I think the ReBar will display when there are
// Add the band that has the toolbar.
SendMessage(hwndRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

What wrong ?

"Timo Kunze" <TKunze71216(a)gmx.de> wrote in message
news:h95a39$i1d$1(a)aioe.org...
> Nhat Dung schrieb:
>> ShowWindow(hWndToolbar, TRUE);
> You're usage of ShowWindow is wrong.
> http://msdn.microsoft.com/en-us/library/ms633548.aspx
>
> But that's not the real problem. I'm not sure what the real problem is,
> but you return from CreateRebar before you add any bands. I'm not sure a
> rebar displays anything if it doesn't contain any bands.
>
> Timo
> --
> www.TimoSoft-Software.de - Unicode controls for VB6
> "Those who sacrifice freedom for safety deserve neither."
> "Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
> Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
> demokratischem Wege – durchsetzen."

From: Timo Kunze on
Nhat Dung schrieb:
> I'm using like Microsoft does:
> Using Toolbar Controls
> http://msdn.microsoft.com/en-us/library/bb760446%28VS.85%29.aspx
> (SW_SHOWNORMAL = 1)

This sample should be fixed then. Okay, TRUE is defined as 1, and so is
SW_SHOWNORMAL, so it's not really a problem. But passing TRUE where a
SW_* constant should be passed is poor style.

> I think the ReBar will display when there are
> // Add the band that has the toolbar.
> SendMessage(hwndRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
>
> What wrong ?

Right after creating the rebar control and before inserting any band,
you call "return hwndRebar;".

Timo
--
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
"Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
demokratischem Wege – durchsetzen."
From: Timo Kunze on
Oh and try without the WS_EX_TOOLWINDOW style.

Timo
--
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
"Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
demokratischem Wege – durchsetzen."