Schnittstellen ansprechen

Hallo Experten!

Ich möchte unbeding die RS232 und parallele Schnittstelle über Borland C++ Builder 5 ansprechen (reinlesen, rausschreiben).

Es soll aber auch auf Win2000 und NT laufen. Ich weiß, dass es da was gibt - aber was?

Kann mir da jemand helfen? (Vielleicht sogar ein Demo-Quellcode schicken).

Danke schon mal,

mfg
Luggi

P.S.: natürlich kann es auch eine Komponente sein - hauptsache es funktioniert.

Schreiben über Serielle Schnittstelle:

HANDLE hCom = CreateFile(„COM2“,GENERIC_WRITE, 0, /* comm devices must be opened w/exclusive-access */
NULL, /* no security attrs */
OPEN_EXISTING, /* comm devices must use OPEN_EXISTING */
0, /* not overlapped I/O */
NULL /* hTemplate must be NULL for comm devices */
);
if (hCom == INVALID_HANDLE_VALUE)
{
dwError = GetLastError(); /* handle error */
AfxMessageBox(„ERROR opening COM PORT“);
}/* * Omit the call to SetupComm to use the default queue sizes. * Get the current configuration. */

fSuccess = GetCommState(hCom, &dcb);
/* Fill in the DCB: baud=9600, 8 data bits, no parity, 1 stop bit. */
dcb.BaudRate = 9600;
dcb.ByteSize = 7;

dcb.fOutxDsrFlow = TRUE;
dcb.fOutxCtsFlow = TRUE;
dcb.fParity = TRUE;
dcb.Parity = ODDPARITY;
dcb.StopBits = ONESTOPBIT;
fSuccess = SetCommState(hCom, &dcb);

unsigned long aa;
char strg[]=„Das ist mein Teststring zum Senden“;
if(WriteFile (hCom,strg,sizeof(strg),&aa,0)==0)AfxMessageBox („ERROR writing to COM PORT“);

CloseHandle(hCom);

Schau mal unter haise (c’t) nach direct nt und deine Fragen sind beantwortet

[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]