RanBN
asked on
Change title to an object from CPrintDialog class
hi,
I would like to change on run time the title of CPrintDialog dialog. I cannot inherit it. is there a way to do so by using one of its members?
thanks in advance, RanBN
I would like to change on run time the title of CPrintDialog dialog. I cannot inherit it. is there a way to do so by using one of its members?
thanks in advance, RanBN
ok, if you cannot inherit it, instantiate a CPrintDialog object then call SetWindowText()
Ex:
...
CPrintDialog dlg(FALSE);
dlg.SetWindowText("YourTit le")
...
Ex:
...
CPrintDialog dlg(FALSE);
dlg.SetWindowText("YourTit
...
ASKER
thanks but,
before DoModal(), hWnd member is NULL, therefore SetWindowText fails.
before DoModal(), hWnd member is NULL, therefore SetWindowText fails.
why can't u create your own CPrintDialog derived class?
in the constructor u can send a CString which would later be the title of your CPrintDialog:
//constructor
CMyPrintDialog::CMyPrintDi alog(CStri ng sTitle, bool bPrintSetupOnly, ...)
{
m_strTitle = sTitle;
}
CMyPrintDialog::OnInitDial og()
{
CPrintDialog::OnInitDialog ();
SetWindowText(m_strTitle);
return TRUE;
}
the code to display your CPrintDialog:
CMyPrintDialog dlg("My Print Dialog", FALSE);
dlg.DoModal();
good luck
in the constructor u can send a CString which would later be the title of your CPrintDialog:
//constructor
CMyPrintDialog::CMyPrintDi
{
m_strTitle = sTitle;
}
CMyPrintDialog::OnInitDial
{
CPrintDialog::OnInitDialog
SetWindowText(m_strTitle);
return TRUE;
}
the code to display your CPrintDialog:
CMyPrintDialog dlg("My Print Dialog", FALSE);
dlg.DoModal();
good luck
the other way i think is to use modaless CPrintDialog and after ->Create() use SetWindowText to change its title, and ShowWindow() to display it.
ASKER
Hi and thanks again,
please let me be more specific about my request:
I would like to take the original CPrintDialog, the one which is located when I click on the standard toolBar "File->Print".
well, I would like to change it my my CMyView class. according the MSDN help, I should override massage OnPreparePrinting(CPrintIn fo* pInfo).
in class CPrintInfo there is a member m_pPD which provides information about the Print dialog. does anyone know what to do with it in order to change caption?
thanks, RanBN
please let me be more specific about my request:
I would like to take the original CPrintDialog, the one which is located when I click on the standard toolBar "File->Print".
well, I would like to change it my my CMyView class. according the MSDN help, I should override massage OnPreparePrinting(CPrintIn
in class CPrintInfo there is a member m_pPD which provides information about the Print dialog. does anyone know what to do with it in order to change caption?
thanks, RanBN
ASKER
Hi and thanks again,
please let me be more specific about my request:
I would like to take the original CPrintDialog, the one which is located when I click on the standard toolBar "File->Print".
well, I would like to change it my my CMyView class. according the MSDN help, I should override massage OnPreparePrinting(CPrintIn fo* pInfo).
in class CPrintInfo there is a member m_pPD which provides information about the Print dialog. does anyone know what to do with it in order to change caption?
thanks, RanBN
please let me be more specific about my request:
I would like to take the original CPrintDialog, the one which is located when I click on the standard toolBar "File->Print".
well, I would like to change it my my CMyView class. according the MSDN help, I should override massage OnPreparePrinting(CPrintIn
in class CPrintInfo there is a member m_pPD which provides information about the Print dialog. does anyone know what to do with it in order to change caption?
thanks, RanBN
as far as i know there's no member in PRINTDLG (m_pd) which is the caption. (according to MSDN)
ASKER
the m_pPD is a pointer to CPrintDialog, but its m_hWnd member is NULL when I have it OnPreparePrinting.
does anyone have an idea?
thanks, RanBN
does anyone have an idea?
thanks, RanBN
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops
m_pPD
must be
pInfo->m_pPD
m_pPD
must be
pInfo->m_pPD
ASKER
thanks alot
Ex:
BOOL CYourDlg::OnInitDialog()
{
...
SetWindowText("YourTitle")
...
}