Author | Topic: Dllexecutecall | |
---|---|---|
Raffaele Lafratta | Dllexecutecall on Fri, 20 Jul 2018 10:37:03 +0200 Hi all I have problems passing a double numeric parameter to a C dll. Parameter seems not to be correctly received by the dll function Anyone can help me ? Regards Raffaele Lafratta | |
Edgar Borger | Re: Dllexecutecall on Fri, 20 Jul 2018 11:21:59 -0300 Hi Raffaele, I use like this : #translate DBL(<num>) => db1(<num>), db2(<num>) Function Db1( n ) local nRet0,nRet1,nRet2 nRet0 := F2Bin( n ) nRet1 := Bin2L( Left( nRet0, 4 ) ) Return nRet1 Function dB2( n ) local nRet0,nRet1,nRet2 nRet0 := F2Bin( n ) nRet2 := Bin2L( Right( nRet0, 4 ) ) Return nRet2 DllCall( xxx, xxx, dbl(nnn), xxx, xxx) Best regards, Edgar Em 20/07/2018 05:37, Raffaele Lafratta escreveu: > Hi all > > I have problems passing a double numeric parameter to a C dll. > Parameter seems not to be correctly received by the dll function > > Anyone can help me ? > > Regards > Raffaele Lafratta Edgar Borger Softsupply Informatica Ltda. Rua Alagoas, 48 Sao Paulo, SP 01242-000 Tel : (5511) 3159-1997 Email : softsupply@terra.com.br | |
Raffaele Lafratta | Re: Dllexecutecall on Mon, 23 Jul 2018 15:58:36 +0200 Il 20/07/2018, Edgar Borger ha detto : > Hi Raffaele, > > I use like this : > > #translate DBL(<num>) => db1(<num>), db2(<num>) > > > Function Db1( n ) > > local nRet0,nRet1,nRet2 > nRet0 := F2Bin( n ) > nRet1 := Bin2L( Left( nRet0, 4 ) ) > > Return nRet1 > > > Function dB2( n ) > > local nRet0,nRet1,nRet2 > nRet0 := F2Bin( n ) > nRet2 := Bin2L( Right( nRet0, 4 ) ) > > Return nRet2 > > > DllCall( xxx, xxx, dbl(nnn), xxx, xxx) > > > Best regards, > Edgar > > > Em 20/07/2018 05:37, Raffaele Lafratta escreveu: >> Hi all >> >> I have problems passing a double numeric parameter to a C dll. >> Parameter seems not to be correctly received by the dll function >> >> Anyone can help me ? >> >> Regards >> Raffaele Lafratta Thanks Edgar but perhaps I don't understand Is the code below correct ? FUNCTION nTodouble(n) local cBin:=F2Bin(n) LOCAL nRet:=Bin2L(Left(cbin,4)) +bin2L(Right(cbin,4)) RETURN nRet Regards Raffaele | |
Edgar Borger | Re: Dllexecutecall on Thu, 26 Jul 2018 09:40:19 -0300 Hi Raffaele, when you call the dll you have to pass 2 parameters for each dbl number, so your function adds (+) > LOCAL nRet:=Bin2L(Left(cbin,4)) + bin2L(Right(cbin,4)) the 2 parts of the number which is NOT correct, that's why I use the #translate, so the dll call DllCall( xxx, xxx, dbl(nnn), xxx) is translated at compile time to DllCall( xxx, xxx, db1(nnn), db2(nnn), xxx) regards, Edgar Em 23/07/2018 10:58, Raffaele Lafratta escreveu: > Il 20/07/2018, Edgar Borger ha detto : >> Hi Raffaele, >> >> I use like this : >> >> #translate DBL(<num>) => db1(<num>), db2(<num>) >> >> >> Function Db1( n ) >> >> local nRet0,nRet1,nRet2 >> nRet0 := F2Bin( n ) >> nRet1 := Bin2L( Left( nRet0, 4 ) ) >> >> Return nRet1 >> >> >> Function dB2( n ) >> >> local nRet0,nRet1,nRet2 >> nRet0 := F2Bin( n ) >> nRet2 := Bin2L( Right( nRet0, 4 ) ) >> >> Return nRet2 >> >> >> DllCall( xxx, xxx, dbl(nnn), xxx, xxx) >> >> >> Best regards, >> Edgar >> >> >> Em 20/07/2018 05:37, Raffaele Lafratta escreveu: >>> Hi all >>> >>> I have problems passing a double numeric parameter to a C dll. >>> Parameter seems not to be correctly received by the dll function >>> >>> Anyone can help me ? >>> >>> Regards >>> Raffaele Lafratta > > Thanks Edgar but perhaps I don't understand > > Is the code below correct ? > > FUNCTION nTodouble(n) > local cBin:=F2Bin(n) > LOCAL nRet:=Bin2L(Left(cbin,4)) +bin2L(Right(cbin,4)) > RETURN nRet > > Regards > Raffaele Edgar Borger Softsupply Informatica Ltda. Rua Alagoas, 48 Sao Paulo, SP 01242-000 Tel : (5511) 3159-1997 Email : softsupply@terra.com.br | |
Raffaele Lafratta | Re: Dllexecutecall on Sun, 29 Jul 2018 09:38:28 +0200 Il 26/07/2018, Edgar Borger ha detto : > Hi Raffaele, > > when you call the dll you have to pass 2 parameters for each dbl number, so > your function adds (+) > > LOCAL nRet:=Bin2L(Left(cbin,4)) + bin2L(Right(cbin,4)) > the 2 parts of the number which is NOT correct, that's why I use the > #translate, so the dll call > > DllCall( xxx, xxx, dbl(nnn), xxx) is translated at compile time to > DllCall( xxx, xxx, db1(nnn), db2(nnn), xxx) > > > regards, > Edgar > > Em 23/07/2018 10:58, Raffaele Lafratta escreveu: >> Il 20/07/2018, Edgar Borger ha detto : >>> Hi Raffaele, >>> >>> I use like this : >>> >>> #translate DBL(<num>) => db1(<num>), db2(<num>) >>> >>> >>> Function Db1( n ) >>> >>> local nRet0,nRet1,nRet2 >>> nRet0 := F2Bin( n ) >>> nRet1 := Bin2L( Left( nRet0, 4 ) ) >>> >>> Return nRet1 >>> >>> >>> Function dB2( n ) >>> >>> local nRet0,nRet1,nRet2 >>> nRet0 := F2Bin( n ) >>> nRet2 := Bin2L( Right( nRet0, 4 ) ) >>> >>> Return nRet2 >>> >>> >>> DllCall( xxx, xxx, dbl(nnn), xxx, xxx) >>> >>> >>> Best regards, >>> Edgar >>> >>> >>> Em 20/07/2018 05:37, Raffaele Lafratta escreveu: >>>> Hi all >>>> >>>> I have problems passing a double numeric parameter to a C dll. >>>> Parameter seems not to be correctly received by the dll function >>>> >>>> Anyone can help me ? >>>> >>>> Regards >>>> Raffaele Lafratta >> >> Thanks Edgar but perhaps I don't understand >> >> Is the code below correct ? >> >> FUNCTION nTodouble(n) >> local cBin:=F2Bin(n) >> LOCAL nRet:=Bin2L(Left(cbin,4)) +bin2L(Right(cbin,4)) >> RETURN nRet >> >> Regards >> Raffaele Thanks Edgar Now It's clear |