![]() |
[SOLVED] TJvHidDeviceController, Probleme mit OnDeviceData
Hi,
ich hab nun hier wieder einmal ein Problem, dass ein Programm auf einem PC geht, auf dem anderen nicht! Beide PCs haben Win7 x86 drauf. Ich habe hier einen Beispielcode der auch auf beiden PCs funktioniert. Das bedeutet es kommen Daten in OnDeviceData an:
Delphi-Quellcode:
Das ist eine selbständige EXE.
unit Unit4;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, JvComponentBase, JvHidControllerClass, HID, HidUsage, StdCtrls; type TForm4 = class(TForm) JvHidDeviceController: TJvHidDeviceController; Memo1: TMemo; procedure OnArrival(HidDev: TJvHidDevice); procedure OnRemoval(HidDev: TJvHidDevice); procedure OnDeviceData(HidDev: TJvHidDevice; ReportID: Byte; const Data: Pointer; Size: Word); private { Private-Deklarationen } public { Public-Deklarationen } end; const VendorID = $16C0; ProductID = $05DF; ProductName = 'AVR USB'; var Form4: TForm4; HIDDevice: TJvHidDevice; ReceivedData : Array[0..5] of Byte; implementation {$R *.dfm} procedure TForm4.OnDeviceData(HidDev: TJvHidDevice; ReportID: Byte; const Data: Pointer; Size: Word); begin CopyMemory(@ReceivedData, Data, Size); Memo1.Lines.Add('Got Data!'); //test end; procedure TForm4.OnArrival(HidDev: TJvHidDevice); var i : integer; begin if ((HidDev.Attributes.VendorID = VendorID) AND (HidDev.Attributes.ProductID = ProductID) AND (HidDev.ProductName = ProductName )) then begin //store device: Memo1.Lines.Add('Device found'); HIDDevice := HidDev; //device found, lets do the init: if HIDDevice.CheckOut then begin //set feature type HIDDevice.ReportTypeParam := HidP_Feature; HIDDevice.UsagePageParam := HID_USAGE_PAGE_GENERIC; HIDDevice.LinkCollectionParam := $01; // CollectionType=Application HIDDevice.UsageParam := HID_USAGE_CONSUMER_UNDEFINED; end; end; end; procedure TForm4.OnRemoval(HidDev: TJvHidDevice); begin if ((Assigned(HIDDevice)) and (NOT HIDDevice.IsPluggedIn)) then begin JvHidDeviceController.CheckIn(HIDDevice); end; end; end. Nun habe ich den Code in ein Plugin (DVBViewer DLL) eingebaut. Das Device wird auf beiden PCs erkannt. Jedoch wird nur bei einem PC die OnDeviceData ausgelößt!? :wall: :wall: Woran kann das liegen? Wie kann ich dem auf die Spur kommen? Auf beiden PCs ist die gleiche DVBViewer Version... Hab den Source nocheinmal komplett neu gemacht, jedoch immer nur bei einem PC das OnDeviceData Event. EDIT: Der Code funktioniert einwandfrei! Nach einer Neuinstallation des DVBViewers geht es nun bei beiden PCs ohne Probleme... |
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:07 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