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

C / C++ / MFC

 
QuestionRe: Create DSN for SQL Server at Run time Pin
David Crow18-May-11 3:08
David Crow18-May-11 3:08 
QuestionOpen other Application From Dialogue Pin
camuoi28817-May-11 22:59
camuoi28817-May-11 22:59 
AnswerRe: Open other Application From Dialogue Pin
Richard MacCutchan17-May-11 23:22
mveRichard MacCutchan17-May-11 23:22 
GeneralRe: Open other Application From Dialogue Pin
camuoi28817-May-11 23:48
camuoi28817-May-11 23:48 
GeneralRe: Open other Application From Dialogue Pin
Richard MacCutchan18-May-11 1:19
mveRichard MacCutchan18-May-11 1:19 
AnswerRe: Open other Application From Dialogue Pin
వేంకటనారాయణ(venkatmakam)17-May-11 23:30
వేంకటనారాయణ(venkatmakam)17-May-11 23:30 
AnswerRe: Open other Application From Dialogue Pin
Legor17-May-11 23:31
Legor17-May-11 23:31 
GeneralRe: Open other Application From Dialogue Pin
camuoi28817-May-11 23:43
camuoi28817-May-11 23:43 
AnswerRe: Open other Application From Dialogue Pin
ShilpiP18-May-11 1:55
ShilpiP18-May-11 1:55 
GeneralRe: Open other Application From Dialogue Pin
camuoi28818-May-11 17:06
camuoi28818-May-11 17:06 
GeneralRe: Open other Application From Dialogue Pin
ShilpiP18-May-11 18:40
ShilpiP18-May-11 18:40 
Questionaccessing the document object model of any window in win32 api or .net Pin
Jayapal Chandran17-May-11 22:35
Jayapal Chandran17-May-11 22:35 
QuestionRe: accessing the document object model of any window in win32 api or .net Pin
Abhi Lahare18-May-11 6:17
Abhi Lahare18-May-11 6:17 
AnswerRe: accessing the document object model of any window in win32 api or .net Pin
Jayapal Chandran18-May-11 13:55
Jayapal Chandran18-May-11 13:55 
GeneralRe: accessing the document object model of any window in win32 api or .net Pin
Abhi Lahare19-May-11 8:43
Abhi Lahare19-May-11 8:43 
QuestionReadFile () reads Junk characters when tried to read from COM1 Port Pin
pandit8417-May-11 3:34
pandit8417-May-11 3:34 
Hi ,

I have created sample application which opens the serial COM Port and tried to write and Read the data.
I have used CreateFile () method to open the COM1.
hCom =  CreateFile (pcCommPort,GENERIC_READ | GENERIC_WRITE,0,NULL, OPEN_EXISTING, 0,NULL );

Then I set the COM state
GetCommState( hCom, &lpCC.dcb);
lpCC.dcb.BaudRate = CBR_9600;     //  baud rate
lpCC.dcb.StopBits = ONESTOPBIT;    //  stop bit
lpCC.dcb.ByteSize = 8;             //  data size, xmit and rcv
lpCC.dcb.Parity   = NOPARITY;      //  parity bit
lpCC.dcb.fBinary = TRUE ;
lpCC.dcb.fParity = TRUE ;
     SetCommState( hCom, &lpCC.dcb );


I am trying to write the data using
WriteFile (hCom,(LPCVOID)ptr,20,&byteswritten,NULL);

and trying to read the data using
ReadFile (hCom, (LPVOID)ptr, 20, &dwBytesTransferred, 0);  

ptr is pointer to the BYTE array. The above code of "ReadFiles() returns true and Reads Junk characters. I have written exact 20 characters through WriteFile() and it returned TRUE . I am not able to figure out the exact problem . Please provide any input in this regards.

Thanks
QuestionRe: ReadFile () reads Junk characters when tried to read from COM1 Port Pin
David Crow17-May-11 3:50
David Crow17-May-11 3:50 
AnswerRe: ReadFile () reads Junk characters when tried to read from COM1 Port Pin
pandit8417-May-11 3:55
pandit8417-May-11 3:55 
GeneralRe: ReadFile () reads Junk characters when tried to read from COM1 Port Pin
barneyman17-May-11 4:01
barneyman17-May-11 4:01 
GeneralRe: ReadFile () reads Junk characters when tried to read from COM1 Port Pin
pandit8417-May-11 4:04
pandit8417-May-11 4:04 
GeneralRe: ReadFile () reads Junk characters when tried to read from COM1 Port [modified] Pin
barneyman17-May-11 4:10
barneyman17-May-11 4:10 
QuestionRe: ReadFile () reads Junk characters when tried to read from COM1 Port Pin
David Crow17-May-11 4:03
David Crow17-May-11 4:03 
AnswerMessage Removed Pin
17-May-11 4:05
pandit8417-May-11 4:05 
QuestionRe: ReadFile () reads Junk characters when tried to read from COM1 Port Pin
David Crow17-May-11 4:13
David Crow17-May-11 4:13 
AnswerRe: ReadFile () reads Junk characters when tried to read from COM1 Port Pin
pandit8417-May-11 4:16
pandit8417-May-11 4:16 

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.