diff options
Diffstat (limited to 'IvyProbe')
-rw-r--r-- | IvyProbe/IvyProbeDlg.cpp | 115 |
1 files changed, 55 insertions, 60 deletions
diff --git a/IvyProbe/IvyProbeDlg.cpp b/IvyProbe/IvyProbeDlg.cpp index dc99158..6982f2a 100644 --- a/IvyProbe/IvyProbeDlg.cpp +++ b/IvyProbe/IvyProbeDlg.cpp @@ -14,32 +14,26 @@ static char THIS_FILE[] = __FILE__;
#endif
+const char * CONVSTR( const CString& str )
+{
+#ifdef UNDER_CE
+
+ static char buffer[4096];
+ int len = str.GetLength();
+ buffer[0] = '\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());
+ }
+ return buffer;
+#else
+ return (LPCSTR) str;
+#endif
+
+}
-/////////////////////////////////////////////////////////////////////////////
-// CAboutDlg dialog used for App About
-class CAboutDlg : public CDialog
-{
-public:
- CAboutDlg();
-
-// Dialog Data
- //{{AFX_DATA(CAboutDlg)
- enum { IDD = IDD_ABOUTBOX };
- //}}AFX_DATA
-
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CAboutDlg)
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //}}AFX_VIRTUAL
-
-// Implementation
-protected:
- //{{AFX_MSG(CAboutDlg)
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
@@ -111,23 +105,23 @@ BOOL CTestDlg::OnInitDialog() {
MyDialog::OnInitDialog();
- // Add "About..." menu item to system menu.
-
- // IDM_ABOUTBOX must be in the system command range.
- ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
- ASSERT(IDM_ABOUTBOX < 0xF000);
-
- CMenu* pSysMenu = GetSystemMenu(FALSE);
- if (pSysMenu != NULL)
- {
- CString strAboutMenu;
- strAboutMenu.LoadString(IDS_ABOUTBOX);
- if (!strAboutMenu.IsEmpty())
- {
- pSysMenu->AppendMenu(MF_SEPARATOR);
- pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
- }
- }
+// // Add "About..." menu item to system menu.
+//
+// // IDM_ABOUTBOX must be in the system command range.
+// ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
+// ASSERT(IDM_ABOUTBOX < 0xF000);
+//
+// CMenu* pSysMenu = GetSystemMenu(FALSE);
+// if (pSysMenu != NULL)
+// {
+// CString strAboutMenu;
+// strAboutMenu.LoadString(IDS_ABOUTBOX);
+// if (!strAboutMenu.IsEmpty())
+// {
+// pSysMenu->AppendMenu(MF_SEPARATOR);
+// pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
+// }
+// }
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
@@ -201,7 +195,7 @@ BOOL CTestDlg::OnInitDialog() // bus->BindMsg("(.*)", BUS_CALLBACK_OF(CTestDlg, IvyCallback ));
//bus->BindMsg("^S( A=([0-9]+))?( B=([0-9]+))?",cb);
- m_busnumber = bus->GetDomain( m_busnumber );
+ m_busnumber = bus->GetDomain( CONVSTR(m_busnumber) );
UpdateData(FALSE);
// force bus start in case of start
@@ -211,18 +205,19 @@ BOOL CTestDlg::OnInitDialog() return TRUE; // return TRUE unless you set the focus to a control
}
-void CTestDlg::OnSysCommand(UINT nID, LPARAM lParam)
-{
- if ((nID & 0xFFF0) == IDM_ABOUTBOX)
- {
- CAboutDlg dlgAbout;
- dlgAbout.DoModal();
- }
- else
- {
- MyDialog::OnSysCommand(nID, lParam);
- }
-}
+
+//void CTestDlg::OnSysCommand(UINT nID, LPARAM lParam)
+//{
+// if ((nID & 0xFFF0) == IDM_ABOUTBOX)
+// {
+// CAboutDlg dlgAbout;
+// dlgAbout.DoModal();
+// }
+// else
+// {
+// MyDialog::OnSysCommand(nID, lParam);
+// }
+//}
@@ -237,8 +232,8 @@ void CTestDlg::OnStart() {
UpdateData(TRUE);
bus->stop();
- m_busnumber = bus->GetDomain( m_busnumber );
- bus->start(m_busnumber);
+ m_busnumber = bus->GetDomain( CONVSTR(m_busnumber) );
+ bus->start(CONVSTR(m_busnumber));
UpdateData(FALSE);
}
@@ -340,12 +335,12 @@ void CTestDlg::OnSend() m_msg.SetEditSel( 0, -1 );
m_msg.GetWindowText( buffer );
if ( buffer.IsEmpty() ) return;
- int count = bus->SendMsg( buffer );
+ int count = bus->SendMsg( CONVSTR(buffer) );
if ( m_msg.FindStringExact(-1, buffer) == CB_ERR )
{
m_msg.AddString( buffer );
}
- WriteMessage( TEXT("Sending %d message %s"),count,(LPCSTR)buffer );
+ WriteMessage( TEXT("Sending %d message %s"),count,CONVSTR(buffer) );
m_msg.Clear();
}
@@ -355,11 +350,11 @@ void CTestDlg::OnBind() m_expr.SetEditSel( 0, -1 );
m_expr.GetWindowText( buffer );
if ( buffer.IsEmpty() ) return;
- int count = bus->BindMsg( buffer , BUS_CALLBACK_OF(CTestDlg, IvyCallback ));
+ int count = bus->BindMsg( CONVSTR(buffer) , BUS_CALLBACK_OF(CTestDlg, IvyCallback ));
if ( m_expr.FindStringExact(-1, buffer) == CB_ERR )
{
m_expr.AddString( buffer );
}
- WriteMessage( TEXT("Binding to %s"), (LPCSTR)buffer );
+ WriteMessage( TEXT("Binding to %s"), CONVSTR(buffer) );
m_expr.Clear();
}
|