I completed do programming and when I built to have an exe file, my VS10 didnt inform any errors and warnings but when I tried to get my exe file processed (Reading the information from COM port), a lot of informed message in the output windows of VS10.
'TestXbee.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'TestXbee.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16661_none_ebfb56996c72aefc\comctl32.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\msimg32.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\mfc100enu.dll', Binary was not built with debug information.
'TestXbee.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file
'TestXbee.exe': Loaded 'C:\Windows\System32\clbcatq.dll', Cannot find or open the PDB file
Dumping objects ->
c:\users\long\desktop\testxbee\testxbee\testxbeedlg.cpp(77) : {250} normal block at 0x002376D8, 28 bytes long.
Data: <t) > 74 29 BF 00 CD CD CD CD 00 00 00 00 00 00 00 00
Object dump complete.
The program '[636] TestXbee.exe: Native' has exited with code 0 (0x0).
And in the Received box of my program, no information was shown. Could u guys help me to overcome my situation ? Thank you very much.
My program:
#include "stdafx.h"
#include "TestXbee.h"
#include "TestXbeeDlg.h"
#include "iostream"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
int n;
/////////////////////////////////////////////////////////////////////////////
// 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)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestXbeeDlg dialog
CTestXbeeDlg::CTestXbeeDlg(CWnd* pParent /*=NULL*/)
: CDialog(CTestXbeeDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CTestXbeeDlg)
m_strReceive = _T("");
m_strResource = _T("");
m_strRSSI = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
serial = new CSerial();
}
void CTestXbeeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTestXbeeDlg)
DDX_Text(pDX, IDC_EDIT_Receive, m_strReceive);
DDX_Text(pDX, IDC_EDIT_Resource, m_strResource);
DDX_Text(pDX, IDC_EDIT_RSSI, m_strRSSI);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTestXbeeDlg, CDialog)
//{{AFX_MSG_MAP(CTestXbeeDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON_Clear, OnBUTTONClear)
ON_BN_CLICKED(IDC_BUTTON_Exit, OnBUTTONExit)
ON_BN_CLICKED(IDC_BUTTON_Start, OnBUTTONStart)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestXbeeDlg message handlers
BOOL CTestXbeeDlg::OnInitDialog()
{
CDialog::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);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
return TRUE; // return TRUE unless you set the focus to a control
}
void CTestXbeeDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CTestXbeeDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CTestXbeeDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
CSerial serial;
void CTestXbeeDlg::OnBUTTONClear()
{
// TODO: Add your control notification handler code here
UpdateData();
m_strReceive = "";
m_strResource ="";
m_strRSSI = "";
UpdateData(false);
}
void CTestXbeeDlg::OnBUTTONExit()
{
// TODO: Add your control notification handler code here
serial->Close();
OnOK();
}
void CTestXbeeDlg::OnBUTTONStart()
{
// TODO: Add your control notification handler code here
serial->Open("COM3",0,0,false);
serial->Setup(CSerial::EBaud9600,CSerial::EData8,CSerial::EParNone,CSerial::EStop1);
serial->SetupReadTimeouts(CSerial::EReadTimeoutNonblocking);
DWORD dwBytesread;
unsigned char m[16];
unsigned char buffer[16];
do
{
serial->Read(m,sizeof(m),&dwBytesread);
if (dwBytesread > 0)
{
for (unsigned i = 0; i < dwBytesread ; i++)
{ buffer[i] = m[i];
}
}
}
while (dwBytesread == sizeof(m));
n = sizeof(m);
m_strReceive = buffer;
CString m_strbuffer;
m_strbuffer = m_strReceive;
a = m_strReceive;
m_strRSSI += (m_strbuffer.Left(14)).Right(2);
b = m_strRSSI;
m_strResource += (m_strbuffer.Left(12)).Right(4);
c = m_strResource;
}
The above is my source code but when I tried to send data to a Xbee which is connected to COM3, no information was shown in Receive, RSSI and Resource box.
I'm a beginner with VC++ so all your helps are highly appreciated.