Hi,Iam new to programming in Visual C++.I am trying tobuild a programm which sends string to serial port.I have managed to open and configure the serial port.A friend of mine wrote a code for me which send integers to serial port.Below is this code.
int CMC35ProjectDlg::Send(BYTE data)
{
///////////
//Begin
//////////
//Send Data to serial Port
DWORD dwBytes=0;
BYTE d=data;
int ret=d;
BYTE* sbuf=&d;
BOOL stest=WriteFile(hcom,sbuf,1,&dwBytes,NULL);
if ((stest&&dwBytes)==FALSE)
{
MessageBox("Connection between your PC and MC35 device connot be establish.\nPlease try again later.\nCheck the serail cabel.\n).",
"Error!",MB_OK | MB_ICONSTOP);
ret=-1;
}
return ret;
//////
//End
//////
}
Do you have any idea how to wrtie a function which sends strings to serial port?
Please help.
Thank you in advance
X - The truth is out there.
int CMC35ProjectDlg::Send(BYTE data)
{
///////////
//Begin
//////////
//Send Data to serial Port
DWORD dwBytes=0;
BYTE d=data;
int ret=d;
BYTE* sbuf=&d;
BOOL stest=WriteFile(hcom,sbuf,1,&dwBytes,NULL);
if ((stest&&dwBytes)==FALSE)
{
MessageBox("Connection between your PC and MC35 device connot be establish.\nPlease try again later.\nCheck the serail cabel.\n).",
"Error!",MB_OK | MB_ICONSTOP);
ret=-1;
}
return ret;
//////
//End
//////
}
Do you have any idea how to wrtie a function which sends strings to serial port?
Please help.
Thank you in advance
X - The truth is out there.