Hi all,

I am trying to place my toolbar on the Windows taskbar, and I do
something like following:

CToolBar toolbar;
CReBar rebar;
HWND hwndTaskbar = ::FindWindow(_T("Shell_TrayWnd"), NULL);
HWND hwndRebar = ::FindWindowEx(hwndTaskbar, NULL,
_T("ReBarWindow32"), NULL);
rebar.Attach(hwndRebar);
toolbar.Create(this);
toolbar.LoadToolBar(IDR_TOOLBAR1);
rebar.AddBar(&toolbar, _T("Text"));

Everything but the last call succeeds, but AddBar fails.

If I create the rebar myself, the AddBar succeeds.

What can be wrong?

Thanks in advance,

Arkadiy