Example #1
0
void COutputTabView::AddMsg(LPCTSTR szFmt, ...)
{
	CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
	CString str;

	// Format the message text
    va_list argptr;
    va_start(argptr, szFmt);
    str.FormatV(szFmt, argptr);
    va_end(argptr);

	str.Replace(_T("\n"), _T("\r\n"));

	

	CString strWndText;
	m_editCtrl1.GetWindowText(strWndText);
	strWndText += str;
	m_editCtrl1.SetWindowText(strWndText);
	
	//m_editCtrl1.SetSel(str.GetLength()-1, str.GetLength()-2, FALSE);
	m_editCtrl1.LineScroll(-m_editCtrl1.GetLineCount());
	m_editCtrl1.LineScroll(m_editCtrl1.GetLineCount()-4);

}
Example #2
0
void CLoggable::AddLogText(bool debug, bool addtostatusbar, LPCTSTR line, va_list argptr)
{
	ASSERT(line != NULL);

	EMULE_TRY

#ifndef NEW_SOCKETS_ENGINE
	if (debug && !g_App.m_pPrefs->GetVerbose())
		return;
#endif //NEW_SOCKETS_ENGINE

	CString sBuffer;

	sBuffer.FormatV(line, argptr);

#ifndef NEW_SOCKETS_ENGINE
	#ifdef _DEBUG
		//SyruS (0.29c) view the log messages while shutting down at least in the debugger
		if (g_App.m_app_state != g_App.APP_STATE_RUNNING)
			TRACE("App Log: %s\n", sBuffer);

	#endif
	if (g_App.m_pMDlg)
		g_App.m_pMDlg->AddLogText(addtostatusbar, sBuffer, debug);	// debug log and normal log handled by the same subroutine now
#else //NEW_SOCKETS_ENGINE
	g_stEngine.AddLog(debug ? LOG_DEBUG : LOG_WARNING, sBuffer);
#endif //NEW_SOCKETS_ENGINE

#ifdef _DEBUG
	if (debug)
		::OutputDebugString(sBuffer + _T("\n"));
#endif

	EMULE_CATCH2
}
Example #3
0
void qprintf(const char* p_format,...)
{
  CString string;
  static CString stringRegister;

  va_list vl;
  va_start(vl,p_format);
  string.FormatV(p_format,vl);
  va_end(vl);


  // See if we must just register the string
  if(string.Right(3) == "<+>")
  {
    stringRegister += string.Left(string.GetLength() - 3);
    return;
  }

  // Print the result to the logfile as INFO
  string = stringRegister + string;
  stringRegister.Empty();

  AutoCritSec lock(&std_stream);
  printf(string);
}
Example #4
0
void CScrollTool::SetText(LPPOINT pos, const TCHAR * fmt, ...)
{
    if (!m_bInitCalled)
    {
        ASSERT( 0 );
        return;
    }

    CString s;
    va_list marker;

    va_start( marker, fmt );
    s.FormatV(fmt, marker);
    va_end( marker );

    CSize textsize(0);
    if (m_bRightAligned)
    {
        CDC *pDC = GetDC();
        textsize = pDC->GetTextExtent(s);
        ReleaseDC(pDC);
    }

    ti.lpszText = s.GetBuffer();
    SendMessage(TTM_UPDATETIPTEXT, 0, (LPARAM)(LPTOOLINFO) &ti);
    SendMessage(TTM_TRACKPOSITION, 0, MAKELONG(pos->x-textsize.cx, pos->y));
    s.ReleaseBuffer();
}
Example #5
0
void CApiLog::LogMessage(CString SourceFile, int nSourceLine, void *pInstance, int nMessageType, LPCTSTR pMsgFormat, ...) const
{
	ASSERT(nMessageType>=4 && nMessageType<=8);
	ASSERT(m_hTargetWnd || m_pApiLogParent);
	ASSERT(nSourceLine>0);


	int pos=SourceFile.ReverseFind(_MPT('\\'));
	if (pos!=-1)
		SourceFile=SourceFile.Mid(pos+1);

	va_list ap;
    
	va_start(ap, pMsgFormat);
	CString text;
	text.FormatV(pMsgFormat, ap);
	va_end(ap);

#ifdef MPEXT
	if (nMessageType>=FZ_LOG_DEBUG)
		return;
#endif

	CString msg;
	msg.Format(_T("%s(%d): %s   caller=0x%08x"), (LPCTSTR)SourceFile, nSourceLine, (LPCTSTR)text, (int)this);
	
	SendLogMessage(nMessageType, msg);
}
Example #6
0
void CLoggable::AddLogText(int iMode, LPCTSTR line, va_list argptr)
{
	ASSERT(line != NULL);

	EMULE_TRY

#ifndef NEW_SOCKETS_ENGINE
	if (((iMode & LOG_FL_DBG) != 0) && !g_App.m_pPrefs->GetVerbose())
		return;
#endif

	CString sBuffer;

	sBuffer.FormatV(line, argptr);

#ifndef NEW_SOCKETS_ENGINE
	#ifdef _DEBUG
		//SyruS (0.29c) view the log messages while shutting down at least in the debugger
		if (g_App.m_app_state != g_App.APP_STATE_RUNNING)
			TRACE("App Log: %s\n", sBuffer);
	#endif

	if (g_App.m_pMDlg)
		g_App.m_pMDlg->AddLogText(iMode, sBuffer);
#else
	g_stEngine.AddLog((iMode & LOG_FL_DBG) ? LOG_DEBUG : LOG_WARNING, sBuffer);
#endif //NEW_SOCKETS_ENGINE

#ifdef _DEBUG
	if ((iMode & LOG_FL_DBG) != 0)
		::OutputDebugString(sBuffer + _T("\n"));
#endif

	EMULE_CATCH2
}
static void Trace(const TCHAR* format, ...)
{
	CString str;
	va_list ptr; va_start(ptr, format);
	str.FormatV(format, ptr);
	va_end(ptr);
	OutputDebugString( str);
}
Example #8
0
void CIrcWnd::AddStatusF(CString sLine, ...)
{
	va_list argptr;
	va_start(argptr, sLine);
	CString sTemp;
	sTemp.FormatV(sLine, argptr);
	va_end(argptr);
	AddStatus(sTemp);
}
Example #9
0
CString String(LPCSTR pszFormat, ...)
{
	va_list argList;
	va_start(argList, pszFormat);
	CString str;
	str.FormatV(pszFormat, argList);
	va_end(argList);
	return str;
}
Example #10
0
void CWinLogFile::LogFormatV(DWORD dwLogLevel, LPCWSTR lpszFormat, va_list args)
{
    if (!IsLevelEnabled(dwLogLevel))
        return;

    CString strMessage;
    strMessage.FormatV(lpszFormat, args);
    Log(dwLogLevel, strMessage);
}
Example #11
0
WaitStatusCursor::WaitStatusCursor(UINT fmtid, ...)
{
	va_list argp;
	va_start(argp, fmtid);
	CString msg;
	msg.FormatV(theApp.LoadString(fmtid).c_str(), argp);
	Create(NULL, IDC_WAIT, msg);
	va_end(argp);
}
Example #12
0
void CClientDlg::Log( LPCTSTR pszFormat, ... )
{
	va_list marker;
	va_start( marker, pszFormat );

	CString s;
	s.FormatV( pszFormat, marker );
	m_LogList.SetCurSel( m_LogList.AddString( s ) );
}
void CLogActions::AddMailLogLine(const char *szFormat, ...)
{
	va_list vaList;
	va_start(vaList,szFormat);
	CString sBuffer;
	sBuffer.FormatV(szFormat,vaList);
	va_end (vaList);
	AddLogLine(GetLogFileName(DEFAULT_ANTISPAMLOG), sBuffer, objSettings.dwMaxMailLogFileSize);
}
Example #14
0
WaitStatusCursor::WaitStatusCursor(LPCTSTR fmt, ...)
{
	va_list argp;
	va_start(argp, fmt);
	CString msg;
	msg.FormatV(fmt, argp);
	Create(NULL, IDC_WAIT, fmt);
	va_end(argp);
}
Example #15
0
void	CHtmlFile::_writeLine(const char* fmt, ...)
{
	va_list	arg;
	va_start(arg, fmt);
	CString temp;
	temp.FormatV(fmt, arg);
	va_end(arg);

	m_buf += temp + "\r\n";
}
Example #16
0
Log& Log::appendf(LPCTSTR format, ...) {
	CString s;
    va_list v;
    va_start(v, format);
	s.FormatV(format, v);
	DWORD size = s.GetLength();

	WriteFile(hFile, (LPCVOID)s, size, &size, NULL);
	return *this;
}
inline CString StrFormat(const char* format, ...)
{
	CString str;
	va_list ptr; va_start(ptr, format);
	str.FormatV(format, ptr);
	// Trace model: ATL::CTrace::s_trace.TraceV(m_pszFileName, m_nLineNo, dwCategory, nLevel, pszFmt, ptr);
	va_end(ptr);
	return str;

}
Example #18
0
void PostOutput( TCHAR *TextAsPrintf, ... )
{
	va_list argptr;
	va_start( argptr, TextAsPrintf );
	
	CString s;
	s.FormatV( TextAsPrintf, argptr );

	PostOutput(s);
}
Example #19
0
CString StrF(const TCHAR * pszFormat, ...)
{
	ASSERT( AfxIsValidString( pszFormat ) );
	CString str;
	va_list argList;
	va_start( argList, pszFormat );
	str.FormatV( pszFormat, argList );
	va_end( argList );
	return str;
}
Example #20
0
WPSFX_API void Log(const TCHAR* what, ...)
{
    CString msg;
    va_list ap;
    va_start(ap, what);
    msg.FormatV(what, ap);
    va_end(ap);

    LOG_WS_INFO(msg);
}
Example #21
0
CustomStatusCursor::CustomStatusCursor(HINSTANCE hinst, LPCTSTR lpCursorName, LPCTSTR fmt, ...)
: m_ended(false)
{
	va_list argp;
	va_start(argp, fmt);
	CString msg;
	msg.FormatV(fmt, argp);
	Create(hinst, lpCursorName, msg);
	va_end(argp);
}
Example #22
0
CustomStatusCursor::CustomStatusCursor(HINSTANCE hinst, LPCTSTR lpCursorName, UINT fmtid, ...)
: m_ended(false)
{
	va_list argp;
	va_start(argp, fmtid);
	CString msg;
	msg.FormatV(theApp.LoadString(fmtid).c_str(), argp);
	Create(hinst, lpCursorName, msg);
	va_end(argp);
}
Example #23
0
MBASEAPI void MIRACLEEXPORT logDebugVA(LPCTSTR lpszFormat,...)
{
	CString msg;
	ASSERT(AfxIsValidString(lpszFormat));
	va_list argList;
	va_start(argList, lpszFormat);
	msg.FormatV(lpszFormat, argList);
	va_end(argList);
	_logDebug(msg);
}
Example #24
0
static void AppendFormat(CString& report, const char *format, ...)
{
  CString buffer;
  va_list valist;

  va_start(valist, format);
  buffer.FormatV(format, valist);
  va_end(valist);
  report += buffer;
}
Example #25
0
void Msg(const char *msg, ...)
{
	CString str;
	va_list ap;
	va_start(ap, msg);
	str.FormatV(msg, ap);
	va_end(ap);
	
	GetBkEndUI()->DoMessageLine(str.operator LPCTSTR(), mmBlueTriangle);
}
Example #26
0
  void WINAPI OutputString(LPCTSTR lpStr, ...)
 {
 	CString StrDes;
 
 	va_list argList;
 	va_start( argList, lpStr );
 	StrDes.FormatV( lpStr, argList );
 	va_end( argList );
 
 	OutputDebugString(StrDes);
 }
void CEsmScriptCompareDlg::AddLogText (const TCHAR* pString, va_list Args) {
  CString Buffer;
  int     Length;

  Buffer.FormatV(pString, Args);
  Buffer += _T("\r\n");

  Length = m_LogText.GetWindowTextLength();
  m_LogText.SetSel(Length, Length);
  m_LogText.ReplaceSel(Buffer);
}
Example #28
0
void CSysProgressDlg::FormatNonPathLine(DWORD dwLine, UINT idFormatText, ...)
{
	va_list args;
	va_start(args, idFormatText);

	CString sText;
	sText.FormatV(CString(MAKEINTRESOURCE(idFormatText)), args);
	SetLine(dwLine, sText, false);

	va_end(args);
}
Example #29
0
void CSysProgressDlg::FormatPathLine ( DWORD dwLine, CString FormatText, ...)
{
	va_list args;
	va_start(args, FormatText);

	CString sText;
	sText.FormatV(CString(FormatText), args);
	SetLine(dwLine, sText, true);

	va_end(args);
}
void    FailCase(const char* format, ...)
{
    va_list list;
    CString s;
    va_start(list, format);
    LogTestFlow("FAILED:\n");
    s.FormatV(format, list);
    s += "\n";
    LogTestFlow("%s", (LPCSTR)s);
    bFailed = TRUE;
}