Using HIDController on Delphi 2010

前端 未结 3 1333
别那么骄傲
别那么骄傲 2020-12-21 14:07

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 HIDC

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-21 14:28

    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.

提交回复
热议问题