Recent

Author Topic: Import .dll faild!  (Read 2621 times)

lijinjie

  • New Member
  • *
  • Posts: 18
Import .dll faild!
« on: October 25, 2021, 04:13:34 am »
Lazarus Ver 2.012

The ControlCAN.dll is for driving the USB-CAN adapter.  there is an example code of Delphi 7, I tried to use it on Lazarus, but got faild.

The .dll file and interface file are included in Delphi7_Example(En).rar.

:) I need your help,Please!

GetMem

  • Hero Member
  • *****
  • Posts: 3520
Re: Import .dll faild!
« Reply #1 on: October 25, 2021, 08:15:39 am »
Lazarus Ver 2.012

The ControlCAN.dll is for driving the USB-CAN adapter.  there is an example code of Delphi 7, I tried to use it on Lazarus, but got faild.

The .dll file and interface file are included in Delphi7_Example(En).rar.

:) I need your help,Please!

Where is the converted Lazarus project? You didn't even try to convert it did you? See attachment...

lijinjie

  • New Member
  • *
  • Posts: 18
Re: Import .dll faild!
« Reply #2 on: October 25, 2021, 09:11:01 am »
Lazarus Ver 2.012

The ControlCAN.dll is for driving the USB-CAN adapter.  there is an example code of Delphi 7, I tried to use it on Lazarus, but got faild.

The .dll file and interface file are included in Delphi7_Example(En).rar.

:) I need your help,Please!

Where is the converted Lazarus project? You didn't even try to convert it did you? See attachment...

I did, and tried the converted code . :) .  I suppose it's a version problem of Lazarus, So I uploaded the orignal delphi code.

the interface file :  ControlCAN.pas  and ControlCAN.dll .

import the controlCAN.pas, put controlCAN.dll into the project folder.      you don't really need to write too many code .

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode Delphi}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,ControlCAN;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     Button1: TButton;
  16.     procedure Button1Click(Sender: TObject);
  17.   private
  18.  
  19.   public
  20.  
  21.   end;
  22.  
  23. var
  24.   Form1: TForm1;
  25.  
  26. implementation
  27.  
  28. {$R *.lfm}
  29.  
  30. { TForm1 }
  31.  
  32. procedure TForm1.Button1Click(Sender: TObject);
  33. begin
  34.      VCI_OpenDevice(1,0,0)
  35. end;
  36.  
  37. end.

[Edited to add code tags: Please read How to use the Forums]
« Last Edit: October 25, 2021, 09:25:07 am by trev »

lijinjie

  • New Member
  • *
  • Posts: 18
Re: Import .dll faild!
« Reply #3 on: October 25, 2021, 09:15:43 am »
I was tring to make it as a widget for the Lazarus.  than I could easly use the USB-CAN interface.


 

TinyPortal © 2005-2018