Selin Metin
2003-10-13 09:19:48 UTC
Hi everyone,
In Windows CE .NET 4.1 I found out that whatever way I choose I can't manage
to get WriteFile or ReadFile to work properly to communicate from serial
ports. The problem is whether I begin with a MFC AppWizard(exe) or write an
MFC class directly and choose "use MFC as a shared dll", the thread in which
I call WriteFile or ReadFile is blocked. I tested this by writing more than
10 test applications, creating seperate threads, using them in the same
thread, etc. I suspected that using SetCommMask and WaitCommEvent is
blocking these threads (and I found only one posting that is pointing to
this), but not using them did not help either. I can easily open the port
with CreateFile, the handle is always valid (I never lose it). CloseHandle
works fine, too. Also these 4 API functions (CreateFile, WriteFile,
ReadFile, CloseHandle) function flawlessly when I open and modify any text
file (.txt extension). Only when I try to access the serial ports using
WriteFile/ReadFile, my threads are blocked. I can work with the user
interface (menus, etc) if they are in a seperate thread. My eVC code works
properly when I port it to Win32, so I'm not using erroneous codes.
I could not find a solution to this problem. I reinstalled PB, recreated my
platform and nothing is changed.
In the past weeks I have posted a couple of messages about this problem to
these newsgroups. Unfortunately I have not received a satisfying answer yet.
So I'm thinking of reporting this as a bug in Windows CE .NET 4.1.
If anyone of you could succeed in creating a serial communication
application using MFC with CE 4.1, I beg from him/her to give me any hints.
I guess that there are people who use this, for if it is a bug in MFCCE, it
is such a basic and important problem that I should not be the first one to
notice this.
Best regards,
Selin Metin
In Windows CE .NET 4.1 I found out that whatever way I choose I can't manage
to get WriteFile or ReadFile to work properly to communicate from serial
ports. The problem is whether I begin with a MFC AppWizard(exe) or write an
MFC class directly and choose "use MFC as a shared dll", the thread in which
I call WriteFile or ReadFile is blocked. I tested this by writing more than
10 test applications, creating seperate threads, using them in the same
thread, etc. I suspected that using SetCommMask and WaitCommEvent is
blocking these threads (and I found only one posting that is pointing to
this), but not using them did not help either. I can easily open the port
with CreateFile, the handle is always valid (I never lose it). CloseHandle
works fine, too. Also these 4 API functions (CreateFile, WriteFile,
ReadFile, CloseHandle) function flawlessly when I open and modify any text
file (.txt extension). Only when I try to access the serial ports using
WriteFile/ReadFile, my threads are blocked. I can work with the user
interface (menus, etc) if they are in a seperate thread. My eVC code works
properly when I port it to Win32, so I'm not using erroneous codes.
I could not find a solution to this problem. I reinstalled PB, recreated my
platform and nothing is changed.
In the past weeks I have posted a couple of messages about this problem to
these newsgroups. Unfortunately I have not received a satisfying answer yet.
So I'm thinking of reporting this as a bug in Windows CE .NET 4.1.
If anyone of you could succeed in creating a serial communication
application using MFC with CE 4.1, I beg from him/her to give me any hints.
I guess that there are people who use this, for if it is a bug in MFCCE, it
is such a basic and important problem that I should not be the first one to
notice this.
Best regards,
Selin Metin