Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > .NET
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 27-08-2015
Panasys Panasys is offline
Miembro
 
Registrado: ago 2007
Posts: 88
Poder: 17
Panasys Va por buen camino
Pasando de C# a Delphi, ultimo round...

Buenas...

Espero poder devolver todo lo que he recibido sobre C# , traigo una consulta:

Tengo dos funciones, la primera:

Código:
GetDeviceData(HANDLE handle, char *Buffer, int BufferSize, const char *TableName, const char *FieldNames,const char *Filter, const char *Options)
Bien esta la manejo con un THandle y funciona ok en Delphi.

Pero la segunda, que es para leer un archivo completo, me da error en la dll

Código:
GetDeviceFileData(void *Handle,char *Buffer,int *BufferSize,const char *FileName,const char *Options)
Ahora me di cuenta que dice void *Handle y no Handle Handle, como paso esa parte a Delphi y lo mejor de todo es que esta pidiendo esa parte, es como una referencia a un puntero, pero el Handle ya lo tengo y es un entero que hace referencia al handle.

La complique mas?

Gracias... (sigo con las placas ZKTeco)

Javier
Responder Con Cita
  #2  
Antiguo 27-08-2015
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.021
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Por favor, recuerda poner títulos descriptivos a tus preguntas, gracias
Responder Con Cita
  #3  
Antiguo 28-08-2015
Avatar de mamcx
mamcx mamcx is offline
Moderador
 
Registrado: sep 2004
Ubicación: Medellín - Colombia
Posts: 3.911
Poder: 25
mamcx Tiene un aura espectacularmamcx Tiene un aura espectacularmamcx Tiene un aura espectacular
Eso no me parece C#???
__________________
El malabarista.
Responder Con Cita
  #4  
Antiguo 31-08-2015
Panasys Panasys is offline
Miembro
 
Registrado: ago 2007
Posts: 88
Poder: 17
Panasys Va por buen camino
Si, es C#, gran parte ya lo tengo pasado a delphi, solo me falta la extraccion de archivos de las placas y llaman a esas funciones, ya probe con pasar el entero del handle a pointer, a pchar, pero no he podido hacer que funcione.
Responder Con Cita
  #5  
Antiguo 31-08-2015
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola.

No conozco C# pero probablemente en este punto se asemeje a C o C++.

De ser así, pienso que el equivalente en Delphi sería algo parecido a este ejemplo:
Código Delphi [-]
function foo(var Handle: Pointer): Integer;
begin
  THandle(Handle) := 1234;
  //...
  Result := 111;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  r: Integer;
  h: THandle;
begin
  r := foo(Pointer(h));
  ShowMessage(Format('%d %d',[h, r]));
end;

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 31-08-2015 a las 18:34:39.
Responder Con Cita
  #6  
Antiguo 09-01-2019
AngelEG AngelEG is offline
Registrado
 
Registrado: dic 2018
Posts: 3
Poder: 0
AngelEG Va por buen camino
Consulta pasando de C# a Delphi

Panasys, buenas noches.

Estoy comenzando con las placas que trabajaste hace un tiempo y veo que en tus comentarios pudiste resolver la función:

Cita:
GetDeviceData(HANDLE handle, char *Buffer, int BufferSize, const char *TableName, const char *FieldNames,const char *Filter, const char *Options)
Yo la declare de la siguiente manera:

Código Delphi [-]
 Function GetDeviceData(Handle: THandle;var Buffer: Byte; BufferSize ;Integer; TableName:String; FileName:String; Filter:String; Options:String):Integer; stdcall external 'plcommpro.dll';

Pero quisiera saber si me puedes/pueden ayudar con los parametros que debo pasarle...

La documentación dice lo siguiente:

Cita:
[Function]
int GetDeviceData(HANDLE handle, char *Buffer, int BufferSize, const char *TableName, const char *FieldNames,const char *Filter, const char *Options)
[Objective]
The function is used to read the device data (for example, the punch records, time segment, user information, and holiday information). The data can be one or multiple records.
[Parameter description]
handle
[in]: The handle that is returned when the connection is successful.
Buffer
[in]: The buffer used to receive the returned data; the returned data is expressed in a text format; if the returned data is multiple records, the multiple records are separated by \r\n.
BufferSize
[in] The size of the buffer used to receive the returned data.
TableName
[in]: Data table name. Attached table 4 lists the available data tables.
FieldNames
[in]: Field name list; the multiple fields are separated by semicolons; * indicates all fields, and the first line in the returned data field is the field names.
Filter
[in]: The conditions of reading the data; the character string in the format of “field name, operator, value” can support multiple conditions, which are separated by commas; for example:
<Field name>=<Value>(no space is allowed at two sides of =)
Options
[in]: Only used to download data of the access control records event effectively at present; when the parameter value is New Record, new records are downloaded. When the value is null, all records are downloaded. When download the other table data, this field can set to an empty string.
[Returned value]
When the returned value is 0 or a positive value, it indicates that the operation is successful (the returned value indicates the number of records). 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:
table = ”user” # Download the user data from the user table
fielname = "*" # Download all field information in the table
pfilter = "” # Have no filtering conditions and thus download all information
options = "”
query_buf = create_string_buffer(4*1024*1024)
query_table = create_string_buffer(table)
query_fieldname = create_string_buffer(fieldname)
query_filter = create_string_buffer(filter)
query_options = create_string_buffer(options)
ret = self.commpro.GetDeviceData(self.hcommpro, query_buf, 4*1024*1024, query_table, query_fieldname, query_filter, query_options)
c#:
int ret = 0;
int BUFFERSIZE = 10 * 1024 * 1024;
byte[] buffer = new byte[BUFFERSIZE];
string devtablename = "user";
string str = "*";
string devdatfilter = "";
string options = "";
ret = GetDeviceData(h, ref buffer[0], BUFFERSIZE, devtablename, str, devdatfilter, options);
al igual si resolviste como leer en tiempo real... desde ya gracias a todos los que se tomen un tiempo de leer todo esto
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Leer Buffer (Pasando de C# a Delphi) Panasys .NET 3 16-07-2015 02:48:40
Confirmación y duda (pasando de Neobook a Delphi) Peri Varios 6 14-05-2008 15:18:00
Ayuda pasando condigo VB a Delphi javier7ar Varios 5 05-12-2007 16:23:20
Problema con round() CFPA86 Varios 1 21-02-2007 20:37:37
problemas selectSQL-Like, pasando datos desde código en el delphi Giniromero SQL 6 22-09-2003 18:49:49


La franja horaria es GMT +2. Ahora son las 22:46:40.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi