Serielle Anschlüsse finden



  • Hallo,
    folgende Frage habe ich.Gibt es eine Funktion die mit einen Array zurüchgibt, der alle schnittstllen(com) zurück liefert?
    Alternativ könnte man das doch hier in eine Schleife packen und alle COM´s bis 256 ausprobieren oder?

    hCom = CreateFile("COM2",
          GENERIC_READ | 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 */
         printf("Mist! nicht geoeffnet\n");
    }
    
    fSuccess = GetCommState(hCom, &dcb);
    
    if (!fSuccess) {
        /* Handle the error. */
        printf("Mist! kein Status\n");
    }
    



Anmelden zum Antworten