Access - access vba funcion con tipo de datos buffer

 
Vista:

access vba funcion con tipo de datos buffer

Publicado por SERGIO HERNANDEZ LARA (1 intervención) el 07/11/2020 19:44:43
Buen día, estoy desarrollando un sistema en Access 2016 y una de las funciones es comunicarse con un equipo que controla la apertura de las barreras de acceso a un residencial

el equipo a controlar es un c3100 de zkteco

y existe comunicacion via red

uno de los comandos es GetDeviceFileData y viene documentada con un ejemplo en C,
pido ayuda para poder implementarla en vba, el problema principal que no he podido resolver es el argumento de tipo buffer, no he encontrado la manera de implementar su equivalente en VBA

Lo que hace la funcion es recibir una tabla del controlador ZKTECO C3-100 en mi caso donde están guardados los registros de cada persona que ha entrado al lugar usando su tarjeta RFID

GetDeviceFileData

[Function]
int GetDeviceFileData(void *Handle,char *Buffer,int *BufferSize,const char *FileName,const char *Options)

[Objective]
The function is used to obtain a file from the device to the PC. It can obtain user file, record file and etc.

[Parameter description]
Handle
[in]: The handle that is returned when the connection is successful.
FileName
[in] The name of the file obtained from the device, for example, the user file’s name is user.dat, record file’s name is transaction.dat.
Buffer
[in]: Buffer used to receive the data.
BufferSize
[in]: Length of the received data.
Options
[in]: The default value is null; it is used for extension.
[Returned value]
When the returned value is 0 or a positive value, it indicates that the operation is successful. When the returned value is a negative value, it indicates that the operation fails. Attached table 5 lists the information about the error codes.

[Example]

Python:
file_name = ”user.dat”
pfile_name = create_string_buffer(file_name)
pbuffer = create_string_buffer(4*102*1024)
ret = self.commpro.GetDeviceFileData(self.hcommpro, pbuffer, buff_len, pfile_name, "")

c#:
int ret = 0;
int buffersize = 4 * 1024 * 1024;
byte[] buffer = new byte[buffersize];
string filename = "user.dat";
string options = "";
ret = GetDeviceFileData(h, ref buffer[0], ref buffersize, filename, options);
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder