Re: MSComm Buffer
Ok, I surrender.
I'm reading your essay about Serial Port ( http://www.flounder.com/serial.htm
) but I've lost very quickly...
Just for test I created a new mfc project with a button.
In the file resources.h I've defined the messages (it's ok here?)
When I click on the button I execute this:
hCom = ::CreateFile( _T("\\\\.\\COM8"), // COM8, just for
test!
GENERIC_READ | GENERIC_WRITE, // desired access
0, // exclusive
NULL, // security
irrelevant
OPEN_EXISTING, // it has to be
there
FILE_FLAG_OVERLAPPED, // open
asynchronous
NULL);
Ok , the ports gets open.
I've created the SerialParameters class, and something about
SerialWriter:
class SerialParameters {
public:
SerialParameters() { hCom = NULL; notifyee = NULL; shutdown =
NULL; }
SerialParameters(HANDLE h, CWnd * w, HANDLE sd) {
hCom = h; notifyee = w; shutdown = sd; }
HANDLE hCom;
CWnd * notifyee;
HANDLE shutdown; //I understan what's hCom and imagine that
notifyee may point to m_pMainWnd, but what's shutdown???
};
class SerialWriter:public CWinThread
{
public:
SerialParameters* params;
protected:
HANDLE WriteEvent;
void OnSendData( WPARAM, LPARAM );
};
Now I'm completly lost...
You say: "So you create the SerialParameters structure with the
appropriate arguments."
I guess once the hCom is created:
SerialParameters* params = new SerialParameters( hCom,
m_pMainWnd, ????? );
Then say:
"To create the thread, do /* SerialWriter * */ writer = (SerialWriter
*)...."
This line throws me an error:
error C2039: 'classSerialWriter' : is not a member of
'SerialWriter'