summaryrefslogtreecommitdiff
path: root/IvyProbe/IvyProbeDlg.cpp
diff options
context:
space:
mode:
authorfcolin2007-02-01 13:10:51 +0000
committerfcolin2007-02-01 13:10:51 +0000
commit0440889eb6038aaf47668f0f5ea2958c0868bdb7 (patch)
treea9cc087f217f1a82be8daf100180e7c1b0e702b8 /IvyProbe/IvyProbeDlg.cpp
parent45ff209d0041034924f45cd35cc39c5634a6573c (diff)
downloadivy-cplusplus-0440889eb6038aaf47668f0f5ea2958c0868bdb7.zip
ivy-cplusplus-0440889eb6038aaf47668f0f5ea2958c0868bdb7.tar.gz
ivy-cplusplus-0440889eb6038aaf47668f0f5ea2958c0868bdb7.tar.bz2
ivy-cplusplus-0440889eb6038aaf47668f0f5ea2958c0868bdb7.tar.xz
Utilisateur : Fcolin Date : 27/03/02 Heure : 12:29 Archivé dans $/Bus/Test Commentaire: Add file load and save for message (vss 13)
Diffstat (limited to 'IvyProbe/IvyProbeDlg.cpp')
-rw-r--r--IvyProbe/IvyProbeDlg.cpp85
1 files changed, 63 insertions, 22 deletions
diff --git a/IvyProbe/IvyProbeDlg.cpp b/IvyProbe/IvyProbeDlg.cpp
index 3ecc751..f504a1c 100644
--- a/IvyProbe/IvyProbeDlg.cpp
+++ b/IvyProbe/IvyProbeDlg.cpp
@@ -14,27 +14,6 @@
static char THIS_FILE[] = __FILE__;
#endif
-const char * CONVSTR( const CString& str )
-{
-#ifdef UNDER_CE
-
- static char buffer[4096];
- int len = str.GetLength();
- buffer[len] = '\0';
- if ( len )
- {
- 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
- return (LPCSTR) str;
-#endif
-
-}
-
-
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
@@ -93,11 +72,36 @@ BEGIN_MESSAGE_MAP(CTestDlg, MyDialog)
ON_BN_CLICKED(IDC_CLOCK_START, OnClockStart)
ON_BN_CLICKED(IDC_CLOCK_FORWARD, OnClockForward)
ON_BN_CLICKED(IDC_CLOCK_FAST_FORWARD, OnClockFastForward)
- ON_WM_SYSCOMMAND()
ON_BN_CLICKED(IDC_CLOCK_RATE, OnClockRate)
+ ON_WM_SYSCOMMAND()
+ ON_COMMAND(FILE_LOAD, OnLoad)
+ ON_COMMAND(FILE_SAVE, OnSave)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
+
+
+const char * CONVSTR( const CString& str )
+{
+#ifdef UNDER_CE
+
+ static char buffer[4096];
+ int len = str.GetLength();
+ buffer[len] = '\0';
+ if ( len )
+ {
+ 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
+ return (LPCSTR) str;
+#endif
+
+}
+
+
/////////////////////////////////////////////////////////////////////////////
// CTestDlg message handlers
@@ -347,3 +351,40 @@ void CTestDlg::OnClockRate()
int count = bus->SendMsg( CONVSTR(buffer) );
WriteMessage( "Sending %d message %s",count,CONVSTR(buffer) );
}
+
+void CTestDlg::OnLoad()
+{
+ CString message;
+
+ CFileDialog dialog( TRUE, "txt", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Ivy Messages Files (*.txt)");
+ if ( dialog.DoModal() == IDOK )
+ {
+ CStdioFile file( dialog.GetPathName(), CFile::modeRead | CFile::typeText );
+ m_msg.ResetContent();
+ while ( file.ReadString(message) )
+ {
+ m_msg.AddString( message );
+ }
+ file.Close();
+ }
+
+}
+
+void CTestDlg::OnSave()
+{
+ CString message;
+
+ CFileDialog dialog( FALSE, "txt" , NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Ivy Messages Files (*.txt)");
+ if ( dialog.DoModal() == IDOK )
+ {
+ CStdioFile file( dialog.GetPathName(), CFile::modeCreate | CFile::modeWrite | CFile::typeText );
+ for (int i=0;i < m_msg.GetCount();i++)
+ {
+ m_msg.GetLBText( i, message );
+ file.WriteString(message + "\n");
+ }
+ file.Close();
+
+ }
+
+}