Click here to Skip to main content
15,912,897 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Implemeting C++ code into a C project Pin
Zeolite25-Jun-07 1:41
Zeolite25-Jun-07 1:41 
GeneralRe: Implemeting C++ code into a C project Pin
ForNow25-Jun-07 12:04
ForNow25-Jun-07 12:04 
GeneralRe: Implemeting C++ code into a C project Pin
ForNow25-Jun-07 12:45
ForNow25-Jun-07 12:45 
AnswerRe: Implemeting C++ code into a C project Pin
Orhun Birsoy25-Jun-07 5:33
Orhun Birsoy25-Jun-07 5:33 
GeneralRe: Implemeting C++ code into a C project Pin
ForNow25-Jun-07 12:28
ForNow25-Jun-07 12:28 
GeneralRe: Implemeting C++ code into a C project Pin
Orhun Birsoy25-Jun-07 12:52
Orhun Birsoy25-Jun-07 12:52 
GeneralRe: Implemeting C++ code into a C project Pin
ForNow25-Jun-07 23:39
ForNow25-Jun-07 23:39 
Questionneed help with port reading! Pin
Leo_133125-Jun-07 0:31
Leo_133125-Jun-07 0:31 
Hello!
below is my code for sending AT command to the port to the device ...
i m suppose to get a response "OK" after sending "AT" to through the port but the result i get are all symbols ... can anyone help me with this ???
Thanks alot!!!

HANDLE m_hCom;
DCB m_dcb;
COMMTIMEOUTS m_CommTimeouts;


DWORD iBytesWritten = 0;
DWORD iBytesRead = 0;
char sBuffer[5];

m_hCom =CreateFile("COM7:",
GENERIC_READ | GENERIC_WRITE,
0, // exclusive access
NULL, // no security
OPEN_EXISTING,
0, // no overlapped I/O
NULL); // null template

SetupComm(m_hCom, 128, 128); // set buffer sizes

GetCommState(m_hCom, &m_dcb);

m_dcb.BaudRate = CBR_9600;
m_dcb.ByteSize = 8;
m_dcb.Parity = NOPARITY;
m_dcb.StopBits = ONESTOPBIT;
m_dcb.fAbortOnError = TRUE;
m_dcb.fBinary = TRUE;

SetCommState(m_hCom, &m_dcb);
GetCommTimeouts (m_hCom, &m_CommTimeouts);

m_CommTimeouts.ReadIntervalTimeout = 0;
m_CommTimeouts.ReadTotalTimeoutConstant = 0;
m_CommTimeouts.ReadTotalTimeoutMultiplier = 0;
m_CommTimeouts.WriteTotalTimeoutConstant = 0;
m_CommTimeouts.WriteTotalTimeoutMultiplier = 0;
SetCommTimeouts (m_hCom, &m_CommTimeouts);

WriteFile(m_hCom,"AT\r",2,&iBytesWritten,NULL);

ReadFile(m_hCom, &sBuffer, 1, &iBytesRead, NULL);

printf("\n%s",sBuffer);

CloseHandle(m_hCom);
AnswerRe: need help with port reading! Pin
CPallini25-Jun-07 0:42
mveCPallini25-Jun-07 0:42 
AnswerRe: need help with port reading! Pin
Roger Stoltz25-Jun-07 0:49
Roger Stoltz25-Jun-07 0:49 
GeneralRe: need help with port reading! Pin
Leo_133126-Jun-07 7:31
Leo_133126-Jun-07 7:31 
GeneralRe: need help with port reading! Pin
flippydeflippydebop26-Jun-07 12:47
flippydeflippydebop26-Jun-07 12:47 
QuestionAn error occur when accessing the file Pin
Y_Kaushik25-Jun-07 0:27
Y_Kaushik25-Jun-07 0:27 
AnswerRe: An error occur when accessing the file Pin
Hamid_RT25-Jun-07 0:53
Hamid_RT25-Jun-07 0:53 
GeneralRe: An error occur when accessing the file Pin
Y_Kaushik25-Jun-07 0:58
Y_Kaushik25-Jun-07 0:58 
GeneralRe: An error occur when accessing the file Pin
Y_Kaushik25-Jun-07 1:10
Y_Kaushik25-Jun-07 1:10 
AnswerRe: An error occur when accessing the file Pin
Rajkumar R25-Jun-07 1:16
Rajkumar R25-Jun-07 1:16 
Questioncontact to Microsoft SQL server Pin
includeh1025-Jun-07 0:26
includeh1025-Jun-07 0:26 
AnswerRe: contact to Microsoft SQL server Pin
Hamid_RT25-Jun-07 0:47
Hamid_RT25-Jun-07 0:47 
GeneralRe: contact to Microsoft SQL server Pin
includeh1025-Jun-07 2:20
includeh1025-Jun-07 2:20 
GeneralRe: contact to Microsoft SQL server Pin
Hamid_RT25-Jun-07 5:31
Hamid_RT25-Jun-07 5:31 
QuestionHow to change color of menu-bar? Pin
includeh1025-Jun-07 0:04
includeh1025-Jun-07 0:04 
QuestionInvisitasking Pin
kenhty24-Jun-07 23:53
kenhty24-Jun-07 23:53 
QuestionDebug Error!!!! Pin
James_Programmer24-Jun-07 23:53
James_Programmer24-Jun-07 23:53 
AnswerRe: Debug Error!!!! Pin
Programm3r25-Jun-07 0:22
Programm3r25-Jun-07 0:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.