hallo.
achso, sorry fürs verlesen. jetzt versteh ich was du meinst, du hast natürlich recht. deine lösung ist beiweitem besser als meine schleife :P
nun habe ich den neu gelöteten schalter.
also wenn nun der taster gedrückt wird, wird ein signal von dtr nach dsr durchgeschleust.
also da der pc sowiso ready ist, wird dann ein modem ready hergestellt.

soweit die theorie.
mit meinem programm terminal kann ich aber leider keine funktion feststellen. com error...? hm.. ich glaube der mann hat sich verlötet, gleich nochmal hinschlappen...

und mein programm läuft egal ob mit oder ohne schalter einfach am waitcommevent vorbei.. also ob er da nicht warten will :P

kannst du mir helfen?


Code:
#include <iostream>

#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <dos.h>
#include <unistd.h>
using namespace std;

int main(void)
{
HANDLE hCOM = CreateFile ("COM1",GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
int anzahl=0;

//////////////////////////////
start:

char lpByte[12];
BOOL len=1;
DWORD dwBytesRecive, EVDSR;


//////////////////////////////
//warteschelife - damit das signal nicht gleich 2 mal abgegriffen wird
printf("Bitte warten!...");
Sleep(2000);
printf("...Weiter.");
//warteschleife ende
//////////////////////////////


//////////////////////////////
//ReadFile(hCOM, &lpByte,len,&dwBytesRecive,NULL);
cout << "" <<endl;
cout <<"------------------------"<<endl;
cout <<"Auf Signal warten."<<endl;
WaitCommEvent(hCOM,&EVDSR,NULL);
cout <<"Signal erhalten."<<endl;
cout <<"------------------------"<<endl;
cout << "" <<endl;
cout << "" <<endl;
printf("%d",dwBytesRecive);
cout << "" <<endl;
cout << "" <<endl;
//////////////////////////////


//////////////////////////////
//datei oeffnen


//funktioniert
cout <<"Increment wird geoeffnet."<<endl;
cout <<"------------------------"<<endl;
system("d:\\Dev-Cpp\\Examples\\inc.bat");
cout <<"------------------------"<<endl;
cout <<"Increment beendet."<<endl;
//datei oeffnen ende
//////////////////////////////

//////////////////////////////
++anzahl;
cout << "" <<endl;
cout << "" <<endl;
printf("Es wurde ");
printf("%d",anzahl);
printf(" mal Incrementiert.");
cout << "" <<endl;
cout << "" <<endl;
//////////////////////////////

cout << "****************************" <<endl;
cout << "" <<endl;

getch();
goto start;
//////////////////////////////

CloseHandle(hCOM);
return 0;
}