From 62f11d551572492be3dfb0604271bc0aba69c1b7 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 13:10:47 +0000 Subject: Utilisateur : Fcolin Date : 19/02/01 Heure : 17:00 Archivé dans $/Bus/Test (vss 11) --- Bus/IvyProbe/IvyProbeDlg.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'Bus/IvyProbe') diff --git a/Bus/IvyProbe/IvyProbeDlg.cpp b/Bus/IvyProbe/IvyProbeDlg.cpp index 6982f2a..4a891d9 100644 --- a/Bus/IvyProbe/IvyProbeDlg.cpp +++ b/Bus/IvyProbe/IvyProbeDlg.cpp @@ -20,11 +20,12 @@ const char * CONVSTR( const CString& str ) static char buffer[4096]; int len = str.GetLength(); - buffer[0] = '\0'; + buffer[len] = '\0'; if ( len ) { - int err = WideCharToMultiByte( CP_ACP, WC_DEFAULTCHAR, str, len, buffer, 4096, "X", NULL ); - if ( err == 0 ) TRACE(TEXT("Error converting chars %d\n"),GetLastError()); + int err = WideCharToMultiByte( CP_ACP, 0, str, len, buffer, 4096, NULL, NULL ); + if ( err == 0 ) + TRACE(TEXT("Error converting chars %d\n"),GetLastError()); } return buffer; #else @@ -242,10 +243,10 @@ void CTestDlg::IvyCallback(IvyApplication *app, int argc, const char **argv) int i; CString text; TRACE(TEXT(" Called function args:")); - WriteMessage( TEXT("Ivy callback %d args"),argc ); + WriteMessage( "Ivy callback %d args",argc ); for ( i = 0; i < argc; i++ ) { - WriteMessage( TEXT(" arg%d='%s'"),i, argv[i] ); + WriteMessage(" arg%d='%s'",i, argv[i] ); TRACE(TEXT(" '%s'"),argv[i]); } TRACE(TEXT("\n")); @@ -301,19 +302,19 @@ TRACE(TEXT("Direct Msg Receive %d, %s\n"),id,arg ); void CTestDlg::OnApplicationConnected(IvyApplication *app) { - WriteMessage( TEXT("Application: %s ready"),(LPCSTR)(app->GetName()) ); + WriteMessage( "Application: %s ready",(LPCSTR)(app->GetName()) ); } void CTestDlg::OnApplicationDisconnected(IvyApplication *app) { - WriteMessage( TEXT("Application: %s bye"),(LPCSTR)(app->GetName()) ); + WriteMessage( "Application: %s bye",(LPCSTR)(app->GetName()) ); } -void CTestDlg::WriteMessage(LPCTSTR format, ...) +void CTestDlg::WriteMessage(const char *format, ...) { - CString str; + char str[4096]; // format and write the data we were given va_list args; va_start(args, format); - str.FormatV(format, args); + vsprintf(str, format, args); m_text.AppendString( str ); } @@ -340,7 +341,7 @@ void CTestDlg::OnSend() { m_msg.AddString( buffer ); } - WriteMessage( TEXT("Sending %d message %s"),count,CONVSTR(buffer) ); + WriteMessage( "Sending %d message %s",count,CONVSTR(buffer) ); m_msg.Clear(); } @@ -355,6 +356,6 @@ void CTestDlg::OnBind() { m_expr.AddString( buffer ); } - WriteMessage( TEXT("Binding to %s"), CONVSTR(buffer) ); + WriteMessage( "Binding to %s", CONVSTR(buffer) ); m_expr.Clear(); } -- cgit v1.1