
add button to dialog dynamically
Christoph:
(a) I think you need WS_CHILD style.
(b) You need to do a ScreenToClient() to get the button rectangle in client
coordinates.
(c) Also, I presume you have gotten rid of the original button with the IDOK
identifier (if you haven't then you are trying to create two controls with the
same ID, which has to create a problem, not quite sure what would happen...).
But you could have just kept the original OK button and used MoveWindow() or
SetWindowPos() to move it.
HTH,
David Wilkinson
===========
David
===============
Quote:
> Hello
> thank for your help. here is my code:
> BOOL CShowFeedbackDlg::OnInitDialog()
> {
> TRACE("\nCShowFeedbackDlg::OnInitDialog");
> CDialog::OnInitDialog();
> SetWindowPos( NULL,
> m_dlgEnclosingRect.left, m_dlgEnclosingRect.top ,
> m_dlgEnclosingRect.Width(), m_dlgEnclosingRect.Height(),
> SWP_NOZORDER );
> CRect buttonRect;
> buttonRect.SetRect(m_dlgEnclosingRect.left, m_dlgEnclosingRect.bottom -35,
> m_dlgEnclosingRect.right, m_dlgEnclosingRect.bottom -5);
> m_bc_ok.Create("OK",BS_PUSHBUTTON, buttonRect, this, IDOK);
> m_bc_ok.ShowWindow(SW_SHOW);
> return TRUE;
> }