示例#1
0
void DisplayDaoException(CDaoException* e)
{
    CString strMsg;
    if (e->m_pErrorInfo!=NULL)
    {
        strMsg.Format(
            _T("%s   (%d)\n\n")
            _T("Would you like to see help?"),
            (LPCTSTR)e->m_pErrorInfo->m_strDescription,
            e->m_pErrorInfo->m_lErrorCode);

        if (AfxMessageBox(strMsg, MB_YESNO) == IDYES)
        {
            WinHelp(GetDesktopWindow(),
                    e->m_pErrorInfo->m_strHelpFile,
                    HELP_CONTEXT,
                    e->m_pErrorInfo->m_lHelpContext);
        }
    }
    else
    {
        strMsg.Format(
            _T("ERROR:CDaoException\n\n")
            _T("SCODE_CODE		=%d\n")
            _T("SCODE_FACILITY	=%d\n")
            _T("SCODE_SEVERITY	=%d\n")
            _T("ResultFromScode	=%d\n"),
            SCODE_CODE		(e->m_scode),
            SCODE_FACILITY	(e->m_scode),
            SCODE_SEVERITY	(e->m_scode),
            ResultFromScode (e->m_scode));
        AfxMessageBox(strMsg);
    }
}
示例#2
0
文件: olemisc.cpp 项目: Rupan/winscp
LPCTSTR AFXAPI AfxGetFacilityString(SCODE sc)
{
	static const TCHAR* rgszFACILITY[] =
	{
		_T("FACILITY_NULL"),
		_T("FACILITY_RPC"),
		_T("FACILITY_DISPATCH"),
		_T("FACILITY_STORAGE"),
		_T("FACILITY_ITF"),
		_T("FACILITY_0x05"),
		_T("FACILITY_0x06"),
		_T("FACILITY_WIN32"),
		_T("FACILITY_WINDOWS"),
	};
	if (SCODE_FACILITY(sc) >= _countof(rgszFACILITY))
		return _T("<Unknown Facility>");

	return rgszFACILITY[SCODE_FACILITY(sc)];
}
示例#3
0
//	Fehler-Behandlung realisieren
void DisplayDaoException(CDaoException* e)
{
	ASSERT (NULL != e);
	ASSERT (e -> IsKindOf (RUNTIME_CLASS(CDaoException)));

	CString strMsg;
	if (e->m_pErrorInfo!=NULL)
	{
		CString strCaption;
		strCaption.Format(_T("Datenbankfehler %ld"), e->m_pErrorInfo->m_lErrorCode);
		strMsg.Format(
			_T("\"%s\"\n\n")
			_T("Hilfe zum Fehler aufrufen ?"),
			(LPCTSTR)e->m_pErrorInfo->m_strDescription);

		if (::MessageBox(GetDesktopWindow(), strMsg, strCaption, 
						 MB_YESNO|MB_ICONQUESTION) == IDYES)
		{
			CString strHelpFile;
			VERIFY (strHelpFile.LoadString (IDS_ERROR_HELP_FILE_NAME));
			::WinHelp(GetDesktopWindow(),
					  // e->m_pErrorInfo->m_strHelpFile,
					  strHelpFile,
					  HELP_CONTEXT,
					  e->m_pErrorInfo->m_lHelpContext);
		}
	}
	else
	{
		strMsg.Format(
			_T("Fehler: CDaoException\n\n")
			_T("SCODE_CODE		=%d\n")	
			_T("SCODE_FACILITY	=%d\n")	
			_T("SCODE_SEVERITY	=%d\n")	
			_T("ResultFromScode	=%d\n"),
			SCODE_CODE		(e->m_scode),
			SCODE_FACILITY	(e->m_scode),
			SCODE_SEVERITY	(e->m_scode),
			ResultFromScode (e->m_scode));
		::MessageBox(GetDesktopWindow(), strMsg, AfxGetAppName (), 
					  MB_OK|MB_ICONINFORMATION);
	}
}
示例#4
0
文件: stdio.c 项目: ngocphu811/rufus
const char* StrError(DWORD error_code)
{
    if ( (!IS_ERROR(error_code)) || (SCODE_CODE(error_code) == ERROR_SUCCESS)) {
        return "Success";
    }
    if (SCODE_FACILITY(error_code) != FACILITY_STORAGE) {
        uprintf("StrError: non storage - %08X (%X)\n", error_code, SCODE_FACILITY(error_code));
        SetLastError(error_code);
        return WindowsErrorString();
    }
    switch (SCODE_CODE(error_code)) {
    case ERROR_GEN_FAILURE:
        return "Undetermined error while formatting";
    case ERROR_INCOMPATIBLE_FS:
        return "Cannot use the selected file system for this media";
    case ERROR_ACCESS_DENIED:
        return "Access to the media is denied";
    case ERROR_WRITE_PROTECT:
        return "Media is write protected";
    case ERROR_DEVICE_IN_USE:
        return "The device is in use by another process\n"
               "Please close any other process that may be accessing the device";
    case ERROR_CANT_QUICK_FORMAT:
        return "Quick format is not available for this device";
    case ERROR_LABEL_TOO_LONG:
        return "The volume label is invalid";
    case ERROR_INVALID_CLUSTER_SIZE:
        return "The selected cluster size is not valid for this device";
    case ERROR_INVALID_VOLUME_SIZE:
        return "The volume size is invalid";
    case ERROR_NO_MEDIA_IN_DRIVE:
        return "Please insert a media in drive";
    case ERROR_NOT_SUPPORTED:
        return "An unsupported command was received";
    case ERROR_NOT_ENOUGH_MEMORY:
        return "Memory allocation error";
    case ERROR_READ_FAULT:
        return "Read error";
    case ERROR_WRITE_FAULT:
        return "Write error";
    case ERROR_OPEN_FAILED:
        return "Could not open media. It may be in use by another process.\n"
               "Please re-plug the media and try again";
    case ERROR_PARTITION_FAILURE:
        return "Error while partitioning drive";
    case ERROR_CANNOT_COPY:
        return "Could not copy files to target drive";
    case ERROR_CANCELLED:
        return "Cancelled by user";
    case ERROR_CANT_START_THREAD:
        return "Unable to create formatting thread";
    case ERROR_BADBLOCKS_FAILURE:
        return "Bad blocks check didn't complete";
    case ERROR_ISO_SCAN:
        return "ISO image scan failure";
    case ERROR_ISO_EXTRACT:
        return "ISO image extraction failure";
    case ERROR_CANT_REMOUNT_VOLUME:
        return "Unable to remount volume. You may have to use the\n"
               "mountvol.exe command to make your device accessible again";
    case ERROR_CANT_PATCH:
        return "Unable to patch/setup files for boot";
    default:
        uprintf("Unknown error: %08X\n", error_code);
        SetLastError(error_code);
        return WindowsErrorString();
    }
}
示例#5
0
const char* _StrError(DWORD error_code)
{
	if ( (!IS_ERROR(error_code)) || (SCODE_CODE(error_code) == ERROR_SUCCESS)) {
		return lmprintf(MSG_050);
	}
	if (SCODE_FACILITY(error_code) != FACILITY_STORAGE) {
		uprintf("StrError: non storage - %08X (%X)\n", error_code, SCODE_FACILITY(error_code));
		SetLastError(error_code);
		return WindowsErrorString();
	}
	switch (SCODE_CODE(error_code)) {
	case ERROR_GEN_FAILURE:
		return lmprintf(MSG_051);
	case ERROR_INCOMPATIBLE_FS:
		return lmprintf(MSG_052);
	case ERROR_ACCESS_DENIED:
		return lmprintf(MSG_053);
	case ERROR_WRITE_PROTECT:
		return lmprintf(MSG_054);
	case ERROR_DEVICE_IN_USE:
		return lmprintf(MSG_055);
	case ERROR_CANT_QUICK_FORMAT:
		return lmprintf(MSG_056);
	case ERROR_LABEL_TOO_LONG:
		return lmprintf(MSG_057);
	case ERROR_INVALID_HANDLE:
		return lmprintf(MSG_058);
	case ERROR_INVALID_CLUSTER_SIZE:
		return lmprintf(MSG_059);
	case ERROR_INVALID_VOLUME_SIZE:
		return lmprintf(MSG_060);
	case ERROR_NO_MEDIA_IN_DRIVE:
		return lmprintf(MSG_061);
	case ERROR_NOT_SUPPORTED:
		return lmprintf(MSG_062);
	case ERROR_NOT_ENOUGH_MEMORY:
		return lmprintf(MSG_063);
	case ERROR_READ_FAULT:
		return lmprintf(MSG_064);
	case ERROR_WRITE_FAULT:
		return lmprintf(MSG_065);
	case ERROR_INSTALL_FAILURE:
		return lmprintf(MSG_066);
	case ERROR_OPEN_FAILED:
		return lmprintf(MSG_067);
	case ERROR_PARTITION_FAILURE:
		return lmprintf(MSG_068);
	case ERROR_CANNOT_COPY:
		return lmprintf(MSG_069);
	case ERROR_CANCELLED:
		return lmprintf(MSG_070);
	case ERROR_CANT_START_THREAD:
		return lmprintf(MSG_071);
	case ERROR_BADBLOCKS_FAILURE:
		return lmprintf(MSG_072);
	case ERROR_ISO_SCAN:
		return lmprintf(MSG_073);
	case ERROR_ISO_EXTRACT:
		return lmprintf(MSG_074);
	case ERROR_CANT_REMOUNT_VOLUME:
		return lmprintf(MSG_075);
	case ERROR_CANT_PATCH:
		return lmprintf(MSG_076);
	case ERROR_CANT_ASSIGN_LETTER:
		return lmprintf(MSG_077);
	case ERROR_CANT_MOUNT_VOLUME:
		return lmprintf(MSG_078);
	case ERROR_NOT_READY:
		return lmprintf(MSG_079);
	default:
		uprintf("Unknown error: %08X\n", error_code);
		SetLastError(error_code);
		return WindowsErrorString();
	}
}