-
1
- #1
Hi,
I´m using Visual C++ 6.0 and windows 98.
I´m trying to write and read data by Serial port (COM 1).
The problem is: when I reset or turn on my computer the following code doesn´t works. It comes back to work only If I start a connection by HiperTerminal. It´s not necessary to keep the connection opened, I just have to start and closed right after for my program begins to run correctly.
The code is:
hCom = CreateFile("COM1",GENERIC_READ | GENERIC_WRITE, 0,
NULL, OPEN_EXISTING,FILE_FLAG_OVERLAPPED,
NULL);
ret = WriteFile(hCom, Buffer, BufferSize,
&NumBytes, Struct);
CloseHandle(hCom);
Anybody could help me?
Thanks
I´m using Visual C++ 6.0 and windows 98.
I´m trying to write and read data by Serial port (COM 1).
The problem is: when I reset or turn on my computer the following code doesn´t works. It comes back to work only If I start a connection by HiperTerminal. It´s not necessary to keep the connection opened, I just have to start and closed right after for my program begins to run correctly.
The code is:
hCom = CreateFile("COM1",GENERIC_READ | GENERIC_WRITE, 0,
NULL, OPEN_EXISTING,FILE_FLAG_OVERLAPPED,
NULL);
ret = WriteFile(hCom, Buffer, BufferSize,
&NumBytes, Struct);
CloseHandle(hCom);
Anybody could help me?
Thanks