AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

USB Port abfragen mit Delphi?

Ein Thema von HorstBS · begonnen am 10. Jan 2006 · letzter Beitrag vom 19. Jan 2006
Antwort Antwort
Robert Marquardt
(Gast)

n/a Beiträge
 
#1

Re: USB Port abfragen mit Delphi?

  Alt 18. Jan 2006, 11:35
Zitat von HorstBS:
Jetzt habe ich ein Problem mit der Kommunitkation. Laut anleitung muss ich ein Hex-Code schicken der ungefaehr so aufgebaut ist:

02 //Rahmen Begin
35 //Port 5 wird angesprochen
03 //Rahmen Ende
Na das sagt doch klar das man 3 Bytes schreiben soll.

Delphi-Quellcode:
var
  count: longword;
  command, inDummy: array [0..2] of Char;
  USBWRITE:Boolean;
  DeviceHandle :THandle;
begin
  commmand[0] := #$02;
  commmand[1] := #$35;
  commmand[2] := #$03;
  inDummy[0] := #0;
  inDummy[1] := #0;
  inDummy[2] := #0;

  DeviceHandle := CreateFile(device, Generic_write, File_share_write, nil, open_existing, 0, 0);

  USBWRITE := DeviceIoControl(DeviceHandle, $04,
                              @command[0], sizeof(command),
                              @inDummy[0], sizeof(inDummy),
                              count, NIL);

  if usbwrite then begin Form1.Label2.Caption:='geht'; end else
                   begin Form1.Label2.Caption:='geht nicht'; end; //Das bekomme ich in dem Fall als Antwort.

  CloseHandle (DeviceHandle);
end;
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:35 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz