Posted on 1998-08-12
I'm having a little problem getting new ReBar control to work. I think I've followed the instructions pretty well but it still won't work.
I'll go over what I've been doing:
I call InitCommonControlsEx() specifying ICC_COOL_CLASSES|ICC_BAR_CLASSES.
I create the ReBar control using CreateWindowEx().
hRebar = CreateWindowEx()...
- dwStyle = WS_CHILD|WS_VISIBLE|RBS_BANDBORDERS|CBRS_ALIGN_ANY.
- dwExStyle = WS_EX_TOOLWINDOW.
- hwndParent = m_hWnd (handle to main frame).
- ClassName = REBARCLASSNAME.
The ReBar gets created.
I create a REBARINFO structure, RBinfo.
- cbSize = sizeof(REBARINFO);
- fMask = 0;
- himl = (HIMAGELIST)NULL;
Send the ReBar a message to intitialize.
::SendMessage(hRebar, RB_SETBARINFO, 0, (LPARAM)(REBARINFO*)&RBinfo);
I figured that I should have a CWnd around to wrap the ReBar so I have a CWnd member m_wndReBar.
Now I create my ToolBar, passing it the wrapper CWnd& of the ReBar as it's owner.
Now, I want to let the ReBar know that my m_wndToolBar is it's child and will be in the bar.
I create a REBARBANDINFO called RBBinfo.
- cbSize = sizeof(REBARBANDINFO);
- fMask = RBBIM_CHILD | RBBIM_CHILDSIZE;// child will be ToolBar
- cxMinChild = 100 (arbitrary. Just testing it)
- cyMinChild = 50 (arbitrary. Just testing it)
- hwndChild = m_wndToolBar.m_hWnd; (handle to ToolBar)
Now I send the ReBar a message to add my ToolBar band.
::SendMessage(hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)(REBARBANDINFO*)&RBBinfo);
After all this, I figured everything would be fine, but the ReBar is not there. It gets drawn but it's not there. It's drawn at the top but I can erase the picture of the ReBar (with the ToolBar inside it) with a MDI frame.
What have I done wrong?
Why is the rebar just a picture of a Rebar and no real?