Re: Problem adding button to dialog derived from CPrintDialog
Duh, yes I know that. I added a button to my dialog resource and then I
added a variable for that button and that is when it would crash. I did
not even have to do anything with the variable. In any case, I managed
to fix it myself by starting over. I am sure that it had to do with the
way I was using the CPrintDialog resource.
Z.K.
Joseph M. Newcomer wrote:
Fine, you have a class definition, but what do you do with it? Adding a variable is just
adding a variable; you have to actually create a window that goes with that variable. You
haven't shown where this is done.
joe
On Sat, 09 Sep 2006 18:18:32 -0700, "Z.K." <NoSpam@nospam.com> wrote:
I have created a dialog based on CPrintDialog and I want to add a third
button, but everytime I do it does not show up when the form is
displayed and if I add a variable, I get exception errors and the
program crashes. I have encluded the header file below, the .cpp file
is a normal dialog file though I overrode the OnInitDialog and hide some
of the controls. Everything works fine until I try to add a control and
I am not sure exactly what I need to do to make my added control visible.
Z.K.
#pragma once
#include "afxwin.h"
// CMyDialog dialog
class CMyDialog : public CPrintDialog
{
DECLARE_DYNAMIC(CMyDialog)
public:
CMyDialog(BOOL bPrintSetupOnly,
// TRUE for Print Setup, FALSE for Print Dialog
DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS
| PD_HIDEPRINTTOFILE | PD_NOSELECTION,CWnd* pParent = NULL); //
standard constructor
virtual ~CMyDialog();
// Dialog Data
enum { IDD = IDD_MYDIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnInitDialog();
CButton m_All;
CStatic m_FromStatic;
CEdit m_FromEdit;
CStatic m_ToStatic;
CEdit m_ToEdit;
CStatic m_GroupPrint;
CStatic m_NumCopies;
CStatic m_CopyPic;
CEdit m_NumCopies_Edit;
CButton m_CollateCheck;
CStatic m_CopiesGroup;
protected:
virtual void OnOK();
virtual void OnCancel();
public:
CButton m_BtnOk;
CButton m_BtnCancel;
};
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm