lazarus a dll
Fanda Kopriva
info na elektronikavyvoj.cz
Neděle Září 17 14:46:05 CEST 2017
Dobry den
mam funkcni program v DELPHI7
hraju si ted s LAZARUSEM a chtel jsem ho pod nej prevest.
Program po prevodu a par opravach funguje stejne ,ale jenom kdyz zrusim
vsechny volani HIDcontroll.DLL .
Jakmile zkusim nejakou funkci zavolat tak se vysledny kod neda spustit .
Preklad v LAZARUSu hlasi "uspech".
Dole je vybrana cast kodu. - hlavni program , volana unita ,a volani DLL
Myslim si ,ze to bude nejaka blbost ve volani DLL ,mozna to uvidite na
prvni pohled.
Zkousel jsem najit nejaky priklad volani DLL z LAZARUSe ,ale nejak
nemuzu nic najit.
Dale mne prekvapila delka vytvoreneho kodu (bez volani DLL). V delphi je
to 460kB a v LAZARUSu je to 19MB.
Neni to priznak nejakeho problemu?
Diky Fanda
v hlavnim programu ***********************************
uses
LCLIntf, .......,HIDctrlIntf;
.....
.....
implementation
VAR
DevList : THIDdeviceList;
procedure TForm1.Button1Click;
var
NumDevices:Byte;
begin
NumDevices:=0;
HIDscanForDevices( DevList,NumDevices,$0000,$0000 );
end;
v HIDctrlIntf *******************************************
UNIT HIDctrlIntf;
{$MODE Delphi}
INTERFACE
TYPE
.....
.....
THIDdeviceInfo = Record
SymLink : ShortString; // symbolic link from registry
BufferSize : Word; // size of the data buffer for
sending/receiving data
Handle : THandle; // handle which is returned when
device is opened
VID : Word; // Vendor ID code
PID : Word; // Product ID code
VersionNumber : Word; // Vrsion information
ManufacturerString : ShortString; // Textual manufacurer information
ProductString : ShortString; // Textual product information
SerialNumberString : ShortString; // Textual serial number information
end;
THIDDeviceList = Array[0..31] of THIDdeviceInfo;
Procedure HIDscanForDevices( Var DeviceList : THIDDeviceList;
Var NumDevices : Byte;
TargetVID,
TargetPID : Word); stdcall; External
'HIDcontrol.dll';
HIDcontrol.dll v delphi funguje
************************************************
Další informace o konferenci Hw-list