Example #1
0
//
/// Displays a message box with the error message passed as a string resource ID in
/// sid. By default, the message box contains either an OK push button or a question
/// mark icon. If an error message can't be found, PostDocError displays a "Message
/// not found" message. choice can be one or more of the MB_Xxxx message  style
/// constants. This function can be overridden.
///
/// Returns an integer
/// identifying the MessageBox option (push-button) selected by the user.
//
uint
TDocManager::PostDocError(TDocument& doc, uint sid, uint choice)
{
  PRECONDITION(GetApplication());
  PRECONDITION(GetApplication()->GetMainWindow());

  tchar buf[256];
  if (GetApplication()->LoadString(sid, buf, sizeof(buf) / sizeof(tchar)) == 0)
#if BI_MSG_LANGUAGE == 0x0411
    _stprintf(buf, "エラー: 文字列 ID %u が見つかりません", sid);
#else
    _stprintf(buf, _T("Error: Message [string ID %u] not found"), sid);
#endif

  if (choice != MB_OK)
    choice |= MB_ICONQUESTION;
  return GetApplication()->GetMainWindow()->MessageBox(buf, doc.GetTitle(), choice);
}