FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour llamar funciones de DLL
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: llamar funciones de DLL
Posted: Mon Feb 03, 2020 08:02 AM

Marcelo,

Para hacer la llamada:

oZk:GetAllUserInfo( 1, @dwEnrollNumber, @Name, @Password, @Privilege, @Enabled )

como declaras dwEnrollNumber en tu PRG ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: llamar funciones de DLL
Posted: Mon Feb 03, 2020 12:08 PM

Antonio,

la declaraci贸n de las variables he probado con LOCAL y STATIC

saludos

Marcelo

Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: llamar funciones de DLL
Posted: Mon Feb 03, 2020 12:20 PM

Antonio,

inicializando las variables

dwEnrollNumber := 0
Name := ''
Password := ''
Privilege := 0
Enabled := .F.

obtengo informacion, no la correcta pero obtengo algo, seguire jugando,

como puedo inicializar de otra manera para que los tipos sean compatibles

gracias por la ayuda

Saludos

Marcelo V铆a

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: llamar funciones de DLL
Posted: Mon Feb 03, 2020 12:34 PM

> obtengo informacion, no la correcta pero obtengo algo, seguire jugando

Que informaci贸n est谩s obteniendo ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: llamar funciones de DLL
Posted: Mon Feb 03, 2020 04:04 PM
Antonio,

te presento el c贸digo en C#

Code (fw): Select all Collapse
private void GetAllUserInfo(string sIp = "10.0.0.44", int iPort = 4370, int iMachineNumber = 1)
{
聽 聽 //Create Standalone SDK class dynamicly.
聽 聽 zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();

聽 聽 axCZKEM1.Connect_Net(sIp, iPort);
聽 聽 int iEnrollNumber = 0;
聽 聽 string sname=String.Empty ;
聽 聽 string sPass = String.Empty;
聽 聽 int iPrivilege = 0;
聽 聽 bool ienabled = false;

聽 聽 axCZKEM1.EnableDevice(iMachineNumber, false);
聽 聽 axCZKEM1.ReadAllUserID(iMachineNumber);//read all the user information to the memory
聽 聽 while (axCZKEM1.GetAllUserInfo(iMachineNumber, ref iEnrollNumber, ref sname, ref sPass, ref iPrivilege,ref 聽ienabled))
聽 聽 {
聽 聽 聽 聽 MessageBox.Show("iEnrollNumber :"+iEnrollNumber.ToString()+
聽 聽 聽 聽 聽 聽 "sname: "+ sname+
聽 聽 聽 聽 聽 聽 "sPass :"+ sPass+
聽 聽 聽 聽 聽 聽 "iPrivilege :"+ iPrivilege+
聽 聽 聽 聽 聽 聽 "ienabled :"+ ienabled

聽 聽 聽 聽 聽 聽 );
聽 聽 }

聽 聽 axCZKEM1.EnableDevice(iMachineNumber, true);
}


Este es el c贸digo en FW

Code (fw): Select all Collapse
#include "fivewin.ch"

function main()
local oZk, aLista := {}
local dwEnrollNumber , Name, Password, Privilege, Enabled 

oZk := CreateObject("zkemkeeper.ZKEM")

oZk:SetCommPassword(12345)
oZk:Connect_Net( "10.0.0.44", 4370 )
oZk:EnableDevice(1, .F.)
oZk:ReadAllUserID(1) 

dwEnrollNumber := 0
Name 聽 聽 聽 聽 聽 := ''
Password 聽 聽 聽 := '' 聽
Privilege 聽 聽 聽:= 0
Enabled 聽 聽 聽 聽:= .F.

do while oZk:GetAllUserInfo( 1, @dwEnrollNumber, @Name, @Password, @Privilege, @Enabled ) 
聽 聽 AADD( aLista, { dwEnrollNumber, Name, Password, Privilege, Enabled } ) 
enddo

? len( aLista )

oZk:EnableDevice(1, .T.)

xBrowse( aLista )

oZk:disconnect()

return nil


la diferencia es que elcodigo de FW esta cn la definici贸n de una clave de acceso oZk:SetCommPassword(12345)

Con la aplicaci贸n de C# se obtiene esta pantalla

https://app.box.com/s/bh7phfn1pxdfbtq46qmxro87eph2d7sj

con FW

https://app.box.com/s/bhxrfsdy6h3ojhv80l2j8ppijl6n6vd6

Un dato mas el programa de C# recupera 229 datos mientras el de FW 589

gracias por la ayuda

Saludos

Marcelo V铆a
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: llamar funciones de DLL
Posted: Fri Feb 14, 2020 03:12 PM

Antonio,

alguna idea sobre esto, o sugerencia de como podr铆a atacar este tema desde otro angulo pero utilizando fivewin

saludos cordiales

Marcelo Via

Continue the discussion