Recent

Author Topic: Using a working delphi HID routine in Lazarus  (Read 659 times)

tormods

  • New Member
  • *
  • Posts: 20
Using a working delphi HID routine in Lazarus
« on: April 18, 2021, 04:07:02 pm »
Hi,
I'm trying to make a routine gathering data from USB HID using a well known routine from internet originally made by by J.W. Beunders, the HID interfaces using a dll file HIDControl.dll and its testprogram runs perfectly in Delphi, when I try to make my own version it compiles well in Lazarus, but get following error when it tries to run:

 The code execution cannot proceed because HIDcontrol.dll was not found.Reinstalling the program may fix this problem.

How to fix this? I am running the 64 bit version of Lazarus, but the HID.dll is found both in system 32 and system 64. Has this anything to do with Lazarus does not see this directory? See atachment, the routine is correctly called from an other unit.

tormods

WooBean

  • Full Member
  • ***
  • Posts: 114
Re: Using a working delphi HID routine in Lazarus
« Reply #1 on: April 18, 2021, 04:47:13 pm »
As you have a working delphi program with the source so what stops you from looking int that code to see how dll is invoked (where dll is located or how it is named)?
Win7/64, Lazarus 2.0.8 win64-win64, FPC 3.0.4

jamie

  • Hero Member
  • *****
  • Posts: 4472
Re: Using a working delphi HID routine in Lazarus
« Reply #2 on: April 18, 2021, 05:45:49 pm »
it has to be a 64 bit DLL.. It maybe found all over but is it really a 64 bit one or 32 bit ?

install the 32 bit version of Lazarus as a secondary install and try that project there.
The only true wisdom is knowing you know nothing

tormods

  • New Member
  • *
  • Posts: 20
Re: Using a working delphi HID routine in Lazarus
« Reply #3 on: April 18, 2021, 09:39:57 pm »
I have downloaded the 32 bit version, compiled my own program and converted the original delphi project, they act likewise - compile OK, program is running (red square button) after couple of seconds the program stops (grey square button) not leaving any message  what has happen. Is it searching (expecting) something and a timer times out. It is difficult to know without any information ..... Attached the unit with the HID interface, if anybody could give me a clue what to do -  :(

jamie

  • Hero Member
  • *****
  • Posts: 4472
Re: Using a working delphi HID routine in Lazarus
« Reply #4 on: April 18, 2021, 10:24:49 pm »
we need to see the Delphi test source file...

I am inclined to believe there could be some messages not getting processed, for example a WM_DEVICECHANGE or something..

The LCL form does not pass all messages through so if there is a message handler in the FORM class of the basic test that is most likely the problem.

 Can you post just the form class of the project that contains the test so we can see what it is expecting to happen.
The only true wisdom is knowing you know nothing

PascalDragon

  • Hero Member
  • *****
  • Posts: 2988
  • Compiler Developer
Re: Using a working delphi HID routine in Lazarus
« Reply #5 on: April 19, 2021, 08:59:46 am »
How to fix this? I am running the 64 bit version of Lazarus, but the HID.dll is found both in system 32 and system 64. Has this anything to do with Lazarus does not see this directory? See atachment, the routine is correctly called from an other unit.

Place the library (of the correct bitness) next to the generated executable to be sure that there aren't any path related problems.

Blade

  • Jr. Member
  • **
  • Posts: 99
Re: Using a working delphi HID routine in Lazarus
« Reply #6 on: April 19, 2021, 12:09:18 pm »
we need to see the Delphi test source file...

A zip containing the source files looks to be here, though the OP can say more specifically where he got his files from.

https://libstock.mikroe.com/projects/download/528/4823/1483813393_usb_hid_dll_for__other_other.zip

tormods

  • New Member
  • *
  • Posts: 20
Re: Using a working delphi HID routine in Lazarus
« Reply #7 on: April 19, 2021, 01:01:30 pm »
I have gone back to the original code in delphi and compiled it (delphi version Berlin, comunity version) and everything works nice without problems. Converted the whole project to Lazarus with windows 32 OS, as seen from attached screen everything works OK, but nothing shows up red run button goes back to grey after a while. Added also the HID file just in case. To me it seems that lazarus does not produce any exe file. Sorry I am lost, I hope that I dont need to go back to Delphi.

 

TinyPortal © 2005-2018