llamar funciones de DLL

Re: llamar funciones de DLL

Postby Antonio Linares » Mon Feb 03, 2020 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: llamar funciones de DLL

Postby Marcelo Via Giglio » Mon Feb 03, 2020 12:08 pm

Antonio,

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

saludos

Marcelo
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: llamar funciones de DLL

Postby Marcelo Via Giglio » 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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: llamar funciones de DLL

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: llamar funciones de DLL

Postby Marcelo Via Giglio » Mon Feb 03, 2020 4:04 pm

Antonio,

te presento el código en C#

Code: Select all  Expand view
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: Select all  Expand view
#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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: llamar funciones de DLL

Postby Marcelo Via Giglio » Fri Feb 14, 2020 3: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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Previous

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 65 guests