Reciban un cordial saludo.
estoy integrando una libreria dll para la conexion de lectoras biometricas pero no me funciona realmente nada.
la informacion del fabricante indica
Cita:
4.1 Connect
[Function] int Connect(const char *Parameters)
[Objective]
The function is used to connect a device. After the connection is successful, the connection handle is returned.
[Parameter description]
[in]: Specify the connection options through the parameter, for example:
"protocol=RS485,port=COM2,baudrate=38400bps,deviceid=1,timeout=50000, passwd=”;
“protocol=TCP,ipaddress=192.168.12.154,port=4370,timeout=4000,passwd=”;
To connect a device, the system needs to transfer the device-related connection parameters.
protocol indicates the protocol used for communication. At present, RS485 and TCP can be used.
port: Communication port of the device. For example, if the RS485 protocol is used, you can set port to
COM1: If the TCP is used, the default port is 4370 unless otherwise noted.
deviceid: Device ID used by the serial port.
baudrate: Baud rate used for the communication of the communication of the serial port.
ipaddress: IP address of the related device for TCP/IP communication.
timeout: Timeout time of the connection (unit: ms)If the network connection is in poor condition, you
should set the parameter to a larger value. Usually, timeout=5000 (5 seconds) can meet the basic network
needs. When the query result contains the error code of -2, you should set timeout to a larger value, for
example, timeout=20000 (20 seconds).
passwd: Connection password of the communication. If the parameter value is null, it indicates that no
password is used.
(Note: The connection parameters are case-sensitive)
[Returned value]
If the device is connected successfully, the connection handle is returned. Otherwise, the error code of 0 is
returned.
[Example]
Python:
params = “protocol=TCP,ipaddress=192.168.12.154,port=4370,timeout=4000,passwd=”
self.commpro = windll.LoadLibrary("plcommpro.dll")
constr = create_string_buffer(params)
self.hcommpro = self.commpro.Connect(constr)
c#:
params = “protocol=TCP,ipaddress=192.168.12.154,port=4370,timeout=2000,passwd=” ;
IntPtr h = Connect(params);
|
en delphi hice la siguiente codificacion para enlazar la libreria pero me genera errores
Código:
Function connect (Parameters : pansichar):integer; stdcall external 'plcommpro.dll';
procedure TForm1.Button1Click(Sender: TObject);
var
parametros:ansistring;
param1:pansichar;
begin
parametros:='protocol=TCP,ipaddress=192.168.12.154,port=4370,timeout=4000,passwd=';
GetMem(param1, Length(parametros)+1);
StrPCopy(param1, parametros);
if connect(param1)=1 then
begin
ShowMessage('Coneactada');
end
else
begin
ShowMessage('Desconeactada');
end;
end;
pero me genera el siguiente error cuando compilo en 64
Cita:
---------------------------
Debugger Fault Notification
---------------------------
Project C:\Users\juliodyn\Documents\Embarcadero\Studio\Projects\lectoras pull\Win64\Debug\Project1.exe faulted with message: ' c0000139 ENTRYPOINT_NOT_FOUND'. Process Stopped. Use Step or Run to continue.
---------------------------
OK
---------------------------
|
y el siguiente error cuando compilo en 32 por ver que pasaba
Cita:
---------------------------
Debugger Fault Notification
---------------------------
Project C:\Users\juliodyn\Documents\Embarcadero\Studio\Projects\lectoras pull\Win32\Debug\Project1.exe faulted with message: 'system exception (code 0xc0000409) at 0x77099610'. Process Stopped. Use Step or Run to continue.
---------------------------
OK
---------------------------
|
Que es lo que estoy haciendo mal?
de antemano gracias por la ayuda que me puedan brindar