Einzelnen Beitrag anzeigen

multi-man

Registriert seit: 10. Jul 2008
16 Beiträge
 
Delphi 7 Professional
 
#8

Re: DLL einbinden octopus.dll

  Alt 23. Jul 2008, 22:17
Speicher reserviert ? Wohl eher nicht
Aber hier mal der Code :
Delphi-Quellcode:
unit octopusU1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

type
  usb_device_handle = Record
  end;

  octopus_context = record
      usb_handle : usb_device_handle;
      error_str : string;
  end;

var

  Form1: TForm1;
  oc1 : octopus_context;


implementation


{$R *.dfm}

function octopus_init(var context: octopus_context): integer; external 'octopus.dll';

function octopus_get_hwdesc(var context: octopus_context; desc: Pchar): Pchar; external 'octopus.dll';

function octopus_open(context: octopus_context): integer; external 'octopus.dll';

procedure TForm1.Button1Click(Sender: TObject);
var
erg : integer;
desc1, desc2 : Pchar;
begin
erg := octopus_init(oc1);
desc1 := octopus_get_hwdesc(oc1,desc2);
form1.Caption := inttostr(erg);

end;


end.
  Mit Zitat antworten Zitat