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;
}