DLL32 Function AdsGetDouble (phTable AS LONG, pucFldName AS LPSTR, @pdValue AS LONG)
DLL32 Function AdsGetDouble (phTable AS LONG, pucFldName AS LPSTR, @pdValue AS _DOUBLE )
Massimo Linossi wrote:Hi.
It is possible to define a double type parameter in the DLL32 definition ?
I have this function to call for retrieving a Double field into an Advantage Database table.
DLL32 Function AdsGetDouble (phTable AS LONG, pucFldName AS LPSTR, @pdValue AS LONG) ;
AS LONG PASCAL FROM "AdsGetDouble" LIB "ACE32.DLL"
The pdValue is a Double field. With the LONG definition I'm losing the decimals.
Thanks a lot.
Massimo
DLL32 Function AdsGetDouble (phTable AS LONG, pucFldName AS LPSTR, @pdValue AS LONGLONG) ;
AS LONG PASCAL FROM "AdsGetDouble" LIB "ACE32.DLL"
Massimo Linossi wrote:I've tried but with LPSTR the return of the function call is
always 5021 : The pointer given was not valid.
#include "fivewin.ch"
#include "c:\xHb\include\ads.ch"
STATIC Ads_Handle, nreturn, handle, handle_index, stringa, stringaUTF, finefile
PROCEDURE Main
LOCAL importo_tot
LOCAL ora_inizio, ora_fine
local aFields:={} , aFile:="C:\TEMP\TEST", bFile:="C:\TEMP\CONTEGGI", contatore:=0
local ora_inizio, ora_fine
LOCAL pucBuf
LOCAL pucBufLen
LOCAL handle, handle_index, tot_records, conta_records
LOCAL COD_UTENTE, IMPORTO
SET DELETED ON
SET CENTURY ON
SET CONFIRM ON
SET DATE BRITISH
SET _3DLOOK ON
SET EPOCH TO 1990
SET EXCLUSIVE OFF
REQUEST HB_LANG_IT
HB_LANGSELECT("IT")
REQUEST ADS
REQUEST RMDBFCDX
REQUEST DBFFPT
rddRegister( "ADS", 1 )
rddsetdefault( "ADS" )
SET SERVER REMOTE
SET FILETYPE TO ADT
SET(_SET_AUTORDER,1)
SET AUTOPEN ON
set(_SET_OPTIMIZE,.F.)
ADSLOCKING(.F.)
eval({||sethandlecount( 120 )})
IF !AdsConnect60("C:\ARCHIVI\DATABASE.ADD", 7, "login", "password", , @Ads_Handle)
MsgStop("Il database non è connesso." , "Attenzione")
Return
ENDIF
AdsConnection(Ads_Handle)
ora_inizio = time()
aadd(aFields, { "COD_UTENTE" , "C" , 10 , 0 })
aadd(aFields, { "TOTALE" , "N" , 12 , 2 })
Ferase(afile + ".DBF")
DbCreate( afile , aFields , "RMDBFCDX" )
USE (aFile) ALIAS APPO EXCLUSIVE NEW VIA "RMDBFCDX"
USE (bFile) ALIAS CONTEGGI SHARED NEW READONLY VIA "RMDBFCDX"
AdsOpenTable90(Ads_Handle, "IMPORTI", "IMPORTI", 0, 1, 0, 1, 2, ,@handle )
AdsGetIndexHandle(handle, "COD_UTENTE", @handle_index )
sele conteggi
Dbgotop()
Do While !eof()
importo_tot = 0
AdsClearScope(handle_index, 1)
AdsClearScope(handle_index, 2)
AdsSetScope(handle_index, 1, conteggi->COD_UTENTE, 10, 2)
AdsSetScope(handle_index, 2, conteggi->COD_UTENTE, 10, 2)
AdsGotoTop(handle_index)
AdsGetRecordCount(handle_index, 3, @tot_records)
conta_records = 0
do while .t.
IMPORTO = 0.00
nReturn = AdsGetDouble(handle, "IMPORTO", @IMPORTO)
*
* here nReturn = 5021 ; the pointer given was not valid
* importo = 0
importo_tot += round(IMPORTO,2)
AdsSkip(handle, 1)
conta_records ++
if conta_records > tot_records
exit
endif
enddo
contatore ++
Select Appo
DbAppend()
Appo->COD_UTENTE = conteggi->COD_UTENTE
Appo->TOTALE = importo_tot
Select conteggi
DbSkip()
Enddo
AdsCloseindex(handle_index)
AdsCloseTable(handle)
ora_fine = time()
Dbcloseall()
MSGINFO(ora_inizio + " " + ora_fine,str(contatore))
AdsDisconnect(Ads_Handle)
AdsApplicationExit()
quit
Return
DLL32 Function Type_AdsGetConnection(adshandle as LONG) ;
AS LONG PASCAL FROM "AdsGetConnectionType" LIB "ACE32.DLL"
DLL32 Function Create_sql(hConnect as LONG, @phStatement as LONG) ;
AS LONG PASCAL FROM "AdsCreateSQLStatement" LIB "ACE32.DLL"
DLL32 Function Close_sql(hStatement as LONG) ;
AS LONG PASCAL FROM "AdsCloseSQLStatement" LIB "ACE32.DLL"
DLL32 Function ADS_DateFormat(stringa_test As LPSTR, @adshandle as LONG) ;
AS LONG PASCAL FROM "AdsGetDateFormat" LIB "ACE32.DLL"
DLL32 Function Verify_Ads(hStatement as LONG, @pucSQL As LPSTR) ;
AS LONG PASCAL FROM "AdsVerifySQL" LIB "ACE32.DLL"
DLL32 Function Error_Ads(@pulErrorCode As LONG, @pucBuf As LPSTR, @pucBufLen As LONG) ;
AS LONG PASCAL FROM "AdsGetLastError" LIB "ACE32.DLL"
DLL32 Function AdsOpenTable(hConnect AS LONG, pucName AS LPSTR, pucAlias AS LPSTR, usTableType AS LONG, usCharType AS LONG, usLockType AS LONG, usCheckRights AS LONG, ulOptions AS LONG, @phTable AS LONG) ;
AS LONG PASCAL FROM "AdsOpenTable" LIB "ACE32.DLL"
DLL32 Function AdsOpenTable90(hConnect AS LONG, pucName AS LPSTR, pucAlias AS LPSTR, usTableType AS LONG, usCharType AS LONG, usLockType AS LONG, usCheckRights AS LONG, ulOptions AS LONG, pucCollation as LONG, @phTable AS LONG) ;
AS LONG PASCAL FROM "AdsOpenTable90" LIB "ACE32.DLL"
DLL32 Function AdsOpenIndex(hTable AS LONG, pucName AS LPSTR, @ahIndex AS LPSTR, @pusArrayLen AS LPSTR ) ;
AS LONG PASCAL FROM "AdsOpenIndex" LIB "ACE32.DLL"
DLL32 Function AdsGetAllIndexes(hTable AS LONG, @ahIndex AS LPSTR, pusArrayLen AS LPSTR ) ;
AS LONG PASCAL FROM "AdsGetAllIndexes" LIB "ACE32.DLL"
DLL32 Function AdsGetIndexHandle(hTable AS LONG, pucIndexOrder AS LPSTR, @phIndex AS LONG ) ;
AS LONG PASCAL FROM "AdsGetIndexHandle" LIB "ACE32.DLL"
DLL32 Function AdsSetScope(hIndex AS LONG, usScopeOption AS LONG, @pucScope AS LPSTR, usScopeLen AS LONG, usDataType AS LONG ) ;
AS LONG PASCAL FROM "AdsSetScope" LIB "ACE32.DLL"
DLL32 Function AdsClearScope(hIndex AS LONG, usScopeOption AS LONG ) ;
AS LONG PASCAL FROM "AdsClearScope" LIB "ACE32.DLL"
DLL32 Function AdsGetRecordCount(hObj AS LONG, usFilterOption AS LONG, @pulCount AS LONG ) ;
AS LONG PASCAL FROM "AdsGetRecordCount" LIB "ACE32.DLL"
DLL32 Function AdsGoTop (phTable AS LONG) ;
AS LONG PASCAL FROM "AdsGoTop" LIB "ACE32.DLL"
DLL32 Function AdsGotoTop (phTable AS LONG) ;
AS LONG PASCAL FROM "AdsGotoTop" LIB "ACE32.DLL"
DLL32 Function AdsGotoRecord (phTable AS LONG, ulRec AS LONG) ;
AS LONG PASCAL FROM "AdsGotoRecord" LIB "ACE32.DLL"
DLL32 Function AdsSkip (phTable AS LONG, ulRec AS LONG) ;
AS LONG PASCAL FROM "AdsSkip" LIB "ACE32.DLL"
DLL32 Function AdsGetField (hTable AS LONG, pucFldName AS LPSTR, @pucBuf AS LPSTR, pulLen AS LONG, usOption AS LONG) ;
AS LONG PASCAL FROM "AdsGetField" LIB "ACE32.DLL"
DLL32 Function AdsGetFieldW (hTable AS LONG, pucFldName AS LPSTR, @pwcBuf AS LPSTR, pulLen AS LONG, usOption AS LONG) ;
AS LONG PASCAL FROM "AdsGetFieldW" LIB "ACE32.DLL"
DLL32 Function AdsGetLong (hTable AS LONG, pucFldName AS LPSTR, @plValue AS LONG) ;
AS LONG PASCAL FROM "AdsGetLong" LIB "ACE32.DLL"
DLL32 Function AdsGetDouble (hTable AS LONG, pucFldName AS LPSTR, @pdValue AS LPSTR) ;
AS LONG PASCAL FROM "AdsGetDouble" LIB "ACE32.DLL"
DLL32 Function AdsGetRecord (hTable AS LONG, @pucRec AS LPSTR, @pucLen AS LONG) ;
AS LONG PASCAL FROM "AdsGetRecord" LIB "ACE32.DLL"
DLL32 Function AdsGetRecordLength (hTable AS LONG, @pucLen AS LONG) ;
AS LONG PASCAL FROM "AdsGetRecordLength" LIB "ACE32.DLL"
DLL32 Function AdsCacheRecords (phTable AS LONG, @usRecords AS LONG) ;
AS LONG PASCAL FROM "AdsCacheRecords" LIB "ACE32.DLL"
DLL32 Function AdsAtEOF (phTable AS LONG, @pbEof AS LONG) ;
AS LONG PASCAL FROM "AdsAtEOF" LIB "ACE32.DLL"
DLL32 Function AdsGetString (phTable AS LONG, pucFldName AS LPSTR, @pucbuf AS LPSTR, @pwcbuf AS LPSTR, pulLen AS LONG, usOption as LONG ) ;
AS LONG PASCAL FROM "AdsGetString" LIB "ACE32.DLL"
DLL32 Function AdsCloseTable (phTable AS LONG) ;
AS LONG PASCAL FROM "AdsCloseTable" LIB "ACE32.DLL"
DLL32 Function AdsCloseIndex (phTable AS LONG) ;
AS LONG PASCAL FROM "AdsCloseIndex" LIB "ACE32.DLL"
IMPORTO = 0.00
Ret := TCertfly.Assinar('C:\xml\R1000_N.xml', 'C:\xml\R1000_ASS.xml', 'MinhaTag','0', '1ce63d4dcefb45e9', '1234');
if Ret = 0 then
ShowMessage('Sucesso')
else
ShowMessage('False');
end;
end.
Massimo Linossi wrote:Hi Enrico.
With this code nReturn is 0 (correct) but IMPORTO is -343597384
IMPORTO = "0.00"
nReturn = AdsGetDouble(handle, "IMP_FORN", @IMPORTO)
msginfo(IMPORTO, str(nReturn))
IMPORTO = "0.00"
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 56 guests