Click here to Skip to main content
15,796,299 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Cedric Moonen14-Apr-08 3:31
Cedric Moonen14-Apr-08 3:31 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Member 336349814-Apr-08 3:39
Member 336349814-Apr-08 3:39 
GeneralRe: C++ new dynamic allocation of memory problem [modified] Pin
JudyL_MD14-Apr-08 5:18
JudyL_MD14-Apr-08 5:18 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Matthew Faithfull14-Apr-08 3:57
Matthew Faithfull14-Apr-08 3:57 
AnswerRe: C++ new dynamic allocation of memory problem Pin
James R. Twine14-Apr-08 4:03
James R. Twine14-Apr-08 4:03 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Joe Woodbury14-Apr-08 7:57
professionalJoe Woodbury14-Apr-08 7:57 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Stephen Hewitt14-Apr-08 16:27
Stephen Hewitt14-Apr-08 16:27 
QuestionSerial communication Pin
FPeeters14-Apr-08 2:05
FPeeters14-Apr-08 2:05 
I configure a connection between my app and the COM1 port of a PC using the following piece of code:

hComm = CreateFile(("COM1"),
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
0);

then using the GetCommState() function for reading the settings of the port and SetCommState() for setting the desired value's and trying to read the inputbuffer with ReadFile() I stumbled on a problem:

When starting my app this reports no error at all but it doesn't detect any input on the serial port (in my case a barcode scanner) and stops the reading function on a time_out and the handle is closed. If I start now (even when my app is still running) the Windows HyperTerminal with the appropriate settings for the scanner communication and quit the HyperTerminal again (even if I didn't scan any code, just establishing the connection and terminating it) and I start my app again the scanned codes are shown. If I check the settings of the DCB they are the same, when I run my app and then HyperTerminal.

Do I have to define something, somewhere regarding the "COM1" string used in the CreateFile section, and if so how is it done?

Frank Peeters
GeneralRe: Serial communication Pin
Cedric Moonen14-Apr-08 2:16
Cedric Moonen14-Apr-08 2:16 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 2:38
FPeeters14-Apr-08 2:38 
QuestionRe: Serial communication Pin
CPallini14-Apr-08 3:11
mveCPallini14-Apr-08 3:11 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 3:18
FPeeters14-Apr-08 3:18 
GeneralRe: Serial communication Pin
Cedric Moonen14-Apr-08 3:22
Cedric Moonen14-Apr-08 3:22 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 3:33
FPeeters14-Apr-08 3:33 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 5:19
FPeeters14-Apr-08 5:19 
GeneralRe: Serial communication Pin
CPallini14-Apr-08 4:04
mveCPallini14-Apr-08 4:04 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 4:36
FPeeters14-Apr-08 4:36 
QuestionRe: Serial communication Pin
CPallini14-Apr-08 5:45
mveCPallini14-Apr-08 5:45 
GeneralRe: Serial communication Pin
Randor 14-Apr-08 6:28
professional Randor 14-Apr-08 6:28 
GeneralRe: Serial communication Pin
CPallini14-Apr-08 6:48
mveCPallini14-Apr-08 6:48 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 20:56
FPeeters14-Apr-08 20:56 
GeneralRe: Serial communication Pin
CPallini14-Apr-08 22:11
mveCPallini14-Apr-08 22:11 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 22:24
FPeeters14-Apr-08 22:24 
GeneralRe: Serial communication Pin
CPallini14-Apr-08 22:47
mveCPallini14-Apr-08 22:47 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 23:09
FPeeters14-Apr-08 23:09 

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.