Hi Jürgen,
Jürgen Jung wrote:
But i don't see how to create a glass-toolbar in a dialog-based application. In your extension the function CreateAeroToolBarCtrl() is only available for WTL::CFrameWindowImpl. Maybe i miss a thing, but i can't see.
- Derive your dialog from aero::CDialogImpl and chain the message map as shown in the article. - Declare in your dialog class a aero:CToolbarCtrl variable, say m_ATB. - In your OnInitDialog() handler: + with m_ATB create the toolbar control if it is not part of the DIALOGTEMPLATE resource, or subclass it. + SetOpaque() the dialog client area except the toolbar rectangle. That should be enough to get what you want:) For instance, with any of the article's sample CAboutDlg, remove the IDC_STATIC group box to get some room and in aboutdlg.h:
// aboutdlg.h : interface of the CAboutDlg class
// ...
class CAboutDlg : public aero::CDialogImpl<CAboutDlg>
{
public:
enum { IDD = IDD_ABOUTBOX };
aero::CToolBarCtrl m_ATB; // added
// ...
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CenterWindow(GetParent());
// create the toolbar and aero enable it
CToolBarCtrl tb = AtlCreateSimpleToolBar(m_hWnd, IDR_MAINFRAME);
aero::Subclass(m_ATB, tb);
// compute the opaque rectangle
RECT rClient, rTB;
GetClientRect(&rClient);
m_ATB.GetWindowRect(&rTB);
rClient.top += rTB.bottom - rTB.top;
// Set the opaque area
SetOpaque(rClient);
return FALSE;
}
If you need to follow-up on this thread, better do it in the article forum. cheers, AR