Click here to Skip to main content
15,886,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GDI+ Bitmap::GetHBITMAP error: Pin
followait1-Dec-07 20:30
followait1-Dec-07 20:30 
GeneralRe: GDI+ Bitmap::GetHBITMAP error: Pin
Mark Salsbery1-Dec-07 20:33
Mark Salsbery1-Dec-07 20:33 
QuestionWhat pointer do I pass to my display function Pin
sclaxplayer1-Dec-07 19:37
sclaxplayer1-Dec-07 19:37 
GeneralRe: What pointer do I pass to my display function Pin
Nelek4-Dec-07 21:13
protectorNelek4-Dec-07 21:13 
Questioninput both text as well as image Pin
keyto1-Dec-07 18:23
keyto1-Dec-07 18:23 
AnswerRe: input both text as well as image Pin
bob169721-Dec-07 19:40
bob169721-Dec-07 19:40 
QuestionWhere to initialize the dialog in CDialogBar? Pin
followait1-Dec-07 15:50
followait1-Dec-07 15:50 
AnswerRe: Where to initialize the dialog in CDialogBar? Pin
Mark Salsbery1-Dec-07 16:27
Mark Salsbery1-Dec-07 16:27 
OnCreate() is not virtual - you need to add a ON_WM_CREATE() message map
entry in your dialogbar class in order for it to be called when the dialog bar is
created.

OnOnitDialog() IS virtual, but CDialogBar doesn't call it.  You can catch it yourself with a message map
entry though, just like CDialogBar does.

Here's a working example.  OnCreate() and HandleInitDialog() are called, in that order.
// CMyDialogBar dialog

IMPLEMENT_DYNAMIC(CMyDialogBar, CDialogBar)

CMyDialogBar::CMyDialogBar()
    : CDialogBar()
{

}

CMyDialogBar::~CMyDialogBar()
{
}

void CMyDialogBar::DoDataExchange(CDataExchange* pDX)
{
    CDialogBar::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_COMBO1, m_ComboBox);
    DDX_Control(pDX, IDC_PROGRESS1, m_ProgressCtrl);
}

CSize CMyDialogBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
{
    CSize size = CDialogBar::CalcFixedLayout(bStretch, bHorz);

    if (!IsFloating())
    {
        CRect rect;
        GetParentOwner()->GetClientRect(&rect);
        if (bHorz)
            size.cx = rect.Width();
        else
            size.cy = rect.Height();
    }

    return size;
}


BEGIN_MESSAGE_MAP(CMyDialogBar, CDialogBar)
    ON_WM_CREATE()
    ON_MESSAGE(WM_INITDIALOG,&CMyDialogBar::HandleInitDialog)
END_MESSAGE_MAP()


// CMyDialogBar message handlers

LRESULT CMyDialogBar::HandleInitDialog(WPARAM wParam, LPARAM lParam)
{
    LRESULT lRet = CDialogBar::HandleInitDialog(wParam, lParam);

    UpdateData(FALSE);

    m_ComboBox.SetWindowText(_T("Test"));

    m_ProgressCtrl.SetRange(0, 100);
    m_ProgressCtrl.SetPos(50);

    return lRet;
}

int CMyDialogBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CDialogBar::OnCreate(lpCreateStruct) == -1)
        return -1;

    return 0;
}



Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

AnswerRe: Where to initialize the dialog in CDialogBar? Pin
bob169721-Dec-07 17:36
bob169721-Dec-07 17:36 
AnswerRe: Where to initialize the dialog in CDialogBar? Pin
Mark Salsbery1-Dec-07 18:25
Mark Salsbery1-Dec-07 18:25 
GeneralRe: Where to initialize the dialog in CDialogBar? Pin
followait1-Dec-07 19:42
followait1-Dec-07 19:42 
Questionparameters vs members Pin
bob169721-Dec-07 14:06
bob169721-Dec-07 14:06 
AnswerRe: parameters vs members Pin
Mark Salsbery1-Dec-07 15:56
Mark Salsbery1-Dec-07 15:56 
GeneralRe: parameters vs members Pin
bob169721-Dec-07 17:14
bob169721-Dec-07 17:14 
QuestionHeader Wrapper Symbol Pin
steph51-Dec-07 11:21
steph51-Dec-07 11:21 
AnswerRe: Header Wrapper Symbol Pin
Bram van Kampen1-Dec-07 11:56
Bram van Kampen1-Dec-07 11:56 
AnswerRe: Header Wrapper Symbol Pin
bob169721-Dec-07 14:22
bob169721-Dec-07 14:22 
Questionreg: error C2440: 'specialization' : cannot convert from '' to ' (__cdecl *)(const char *)' [modified] Pin
naresh_t1-Dec-07 3:45
naresh_t1-Dec-07 3:45 
GeneralRe: reg: error C2440: 'specialization' : cannot convert from '' to ' (__cdecl *)(const char *)' Pin
David Crow14-Mar-08 5:59
David Crow14-Mar-08 5:59 
Questionclasses and inline functions Pin
Lutosław1-Dec-07 2:39
Lutosław1-Dec-07 2:39 
GeneralRe: classes and inline functions Pin
David Crow14-Mar-08 6:03
David Crow14-Mar-08 6:03 
QuestionBitmap button Pin
Schehaider_Aymen1-Dec-07 2:34
Schehaider_Aymen1-Dec-07 2:34 
AnswerRe: Bitmap button Pin
Hamid_RT1-Dec-07 3:14
Hamid_RT1-Dec-07 3:14 
GeneralRe: Bitmap button Pin
Schehaider_Aymen1-Dec-07 3:18
Schehaider_Aymen1-Dec-07 3:18 
GeneralRe: Bitmap button Pin
Schehaider_Aymen1-Dec-07 3:23
Schehaider_Aymen1-Dec-07 3:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.