qvreaderror.cpp

来自「Windows上的MUD客户端程序」· C++ 代码 · 共 44 行

CPP
44
字号
#include <stdarg.h>
#include <QvString.h>
#include <QvInput.h>
#include <QvReadError.h>
#if (defined(WIN32) && !defined(_CONSOLE)) || defined(WIN16)
#include <windows.h>
#endif

// This is defined in ChConst.h, if you change this ID then update 
// ChConst.h
#if !defined( WM_VRML_PARSE_ERROR )
#define WM_VRML_PARSE_ERROR					(WM_USER + 406)
#endif

void
QvReadError::post(const QvInput *in, const char *formatString ...)
{
    char	buf[10000];
    va_list	ap;

    va_start(ap, formatString);
    vsprintf(buf, formatString, ap);
    va_end(ap);

    QvString locstr;
    in->getLocationString(locstr);
#if (defined(WIN32) && !defined(_CONSOLE)) || defined(WIN16)
	char *abuf = new char[500];
	wsprintf(abuf,"VRML read error: %s\n%s\n", buf, locstr.getString());
	if ( !in->GetAsyncNotificationInfo() )
	{
		MessageBox(0, abuf, 0, MB_OK | MB_ICONEXCLAMATION );
		delete [] abuf;
	}
	else
	{
		HWND hNotify = (HWND)in->GetAsyncNotificationInfo();
		::PostMessage( hNotify, WM_VRML_PARSE_ERROR, 0, (LPARAM)abuf );
	}
#else
    fprintf(stderr, "VRML read error: %s\n%s\n", buf, locstr.getString());
#endif
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?