-
August 3rd, 2006, 08:36 AM
#1
AfxMessageBox() title
Hi All,
If i display a message using AfxMessageBox() then the title of the popup window is the name of the project. Is there anyway that i can change that to something else?
Any help would be great.
naim1
-
August 3rd, 2006, 08:44 AM
#2
Re: AfxMessageBox() title
Use ::MessageBox() instead. I am not sure if you can easily change the title using AfxMessageBox.
-
August 3rd, 2006, 08:52 AM
#3
Re: AfxMessageBox() title
If it is suitable, you can change the name of your application (set by default to the name of the project) by editing a resource string named AFX_IDS_APP_TITLE. This string seems to be used by AfxMessageBox as the caption.
I hope this helps.
-
August 3rd, 2006, 08:55 AM
#4
Re: AfxMessageBox() title
One solution to change the caption text in whole application when call AfxMessageBox is to override CWinApp::DoMessageBox:
Code:
class CMyApp : public CWinApp
{
// ...
// Overrides
public:
virtual int DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt);
// ...
};
Code:
int CMyApp::DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt)
{
// disable windows for modal dialog
EnableModeless(FALSE);
HWND hWndTop;
HWND hWnd = CWnd::GetSafeOwner_(NULL, &hWndTop);
// determine icon based on type specified
if ((nType & MB_ICONMASK) == 0)
{
switch (nType & MB_TYPEMASK)
{
case MB_OK:
case MB_OKCANCEL:
nType |= MB_ICONEXCLAMATION;
break;
case MB_YESNO:
case MB_YESNOCANCEL:
nType |= MB_ICONEXCLAMATION;
break;
case MB_ABORTRETRYIGNORE:
case MB_RETRYCANCEL:
break;
}
}
LPCTSTR pszCaption = _T("Asta-i pohta ce-am pohtit");
int nResult = ::MessageBox(hWnd, lpszPrompt, pszCaption, nType);
// re-enable windows
if (hWndTop != NULL)
::EnableWindow(hWndTop, TRUE);
EnableModeless(TRUE);
return nResult;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|