2
votes

I have an application that uses HID Controller on delphi 7 but now I need to use it on Delphi 2010(license problems) but I've found some compatibility problems of this HIDController in this delphi 2010. This library is part of Project JEDI.

I notice some questions from people using this library(JvHidDeviceController component) with Delphi 2010 and Win7. Maybe someone who faced the same problem could help me. I now its possible I just can't figure how.

3
Do you have use the same version for Delphi 2010 as you have used for 7? They are probably not compatible.Toon Krijthe
What are "some compatibility problems"? We can't see your screen from here, and you've asked nothing that can be answered here. You mention "the same problem", but since you don't say what the problem is no one can say whether they've faced the same one or not. You need to provide a lot more information before anyone can possibly help you.Ken White
I just use the unit 'JvHidControllerClass' which works in Delphi 7 and 2010..XE too. It's in the HidController.dpk package which I compile and install into a new IDE. The readme with it shows "1.0.34 introduces several Windows version dependent methods." so this should give you the version.Brian Frost
Brian, i'm using the same version as you. I can intall the component on Delhpi 2010 but when i try to compile the project using "JvHidDeviceController" it gives the error: "device cannot be opened". Shearching the web i found some people talking about Delphi 2010 incompatibility. Now i don't know what the real problem is...Nathalia
@Nathalia: I'm on sticky ground then, I'm simply using it to get at a temperature probe which is known to be an HID device. Have you tried the sample code that ships with the JvHid stuff? I'm sure that it should be easy to test open the mouse or something. Check also that you can see the 'inserted' and 'removed' events with a breakpoint. This may point you to a problem with how you are handling events.Brian Frost

3 Answers

3
votes

This is working code for D2010: Use package from this site: HIDController DPK

And replace JvHidControllerClass.pas with version from this site: Modified source file

Major trouble is in string and AnsiString declaration, so this file resolve this incompatibility.

P.S. Use zipped version of file from the post.

2
votes

Apparently the "device can not be opened" problem (Natalia) has also to do with unicode characters. The new version of HIDController pointed to in answer 1 does not solve this problem.

Solution: Change the type of the last parameter of TJvHIDPnPInfo.Create (unit JvHIDController.pas) in "PAnsiChar" in stead of "PChar". Do not forget to change also the typecast where the routine is "called".

p.s. the links to "Modified source file" and "zipped version" in answer 1 are dead.

0
votes

In Delphi 2010 all vars declared as string are unicode type (wide string). When porting components from earlier versions (Delphi 7) to newer version always check all vars declared as string and pchar. In newer version this vars needs to be declared as AnsiString and PAnsyChar which will most likely solve your problems. Of course you have to make sure if you call any dll functions to call proper one _W (when calling function with wide string params) or _A when using AnsiString. However another thing to mention is to check documentation for HID to see what type of params are accepted and use them properly within newer delphi version. I wrote my hid controller (similar) from scratch while there was no existing one by that time and of course when I ported it to Delphi2010 different string types was my main issue. It was similar when I wrote WinUsbController to use WinUSB driver. It's mandatory to read manuals (MSDN), check in headers (.h) and read delphi help (for string) to match proper data types.