is it possible (and how) to change the text of a button in
AfxMessageBox()! Background is, that i want to support diverent
languages in my application. Thanks for any hint.
Horst
--
======================================================================
Visolution GmbH, Systemlösungen für Bildverarbeitung
Horst Steigner
Barthelsmühlring 18
D-76870 Kandel
Tel.: 07275/9593-0
Fax: 07275/9593-33
email: H.Ste...@visolution.de
http://www.visolution.de
======================================================================
Cheers
Check Abdoul
-------------------
"Horst Steigner" <h.ste...@visolution.de> wrote in message
news:3b94d822$1...@news.punkt.de...
thanks for the hint. Overriding the DoMessageBox() is exactly what i
want to avoid. Because i have to write code for the whole handling of
the dialog (e.g. resizing the static field for the message text,
resizing the dialog itself depending of the size of the message text,
arrange the buttons ...). So i'm looking for an easier and less time
intensive solution.
Is overriding DoMessageBox() really the only way to change text of the
buttons in AfxMessageBox()?
Best regards
Yes, it is the only way. The standard message box text is hard-coded
within Windows, not accessible from MFC or the API.
--
Scott McPhillips [VC++ MVP]
You could experiment with something along these lines...
void AFXAPI AfxHookWindowCreate(CWnd* pWnd);
BOOL AFXAPI AfxUnhookWindowCreate();
class CMessageBox : public CDialog
{
public:
int DoModal(LPCTSTR lpszText, UINT nType=MB_OK, UINT nIDHelp = 0)
{
AfxUnhookWindowCreate();
AfxHookWindowCreate(this);
return AfxMessageBox(lpszText, nType, nIDHelp);
}
protected:
virtual BOOL OnInitDialog()
{
BOOL bRet = CDialog::OnInitDialog();
if (CWnd* pWnd = GetDlgItem(IDOK))
pWnd->SetWindowText(_T("I Agree"));
return bRet;
}
// Messages
LRESULT CMessageBox::InternalInitDialog(WPARAM, LPARAM)
{
return (LRESULT)OnInitDialog();
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CMessageBox, CDialog)
ON_MESSAGE(WM_INITDIALOG, InternalInitDialog)
END_MESSAGE_MAP()
void CMainPageOne::OnButtonProceed()
{
CMessageBox mb;
mb.DoModal(_T("You must accept the terms of this license before proceeding..."));
}
HTH,
Jeff...
--
Please post all follow-ups to the newsgroup only.
seems to be an absolutly great solution. Thanks alot. All i have to do
is removing calls of AfxMessageBox() with CMessageBox::DoModal(). But
there i still one problem left. Messages from MFC are still shown using
AfxMessageBox().