open "LBcheetah2.dll" for dll as #DBF print "DBaddDate$(=|"; DBaddDate$("20151231", 5); "|" print DBdaysApart("20151231", "20160105") [ProgramEnd] print "Program ended." end function DBaddDate$(StartDate$, Days) StartDate$ = trim$(StartDate$) + chr$(0) CallDll #DBF, "DBADDDATE", StartDate$ AS PTR, AddDate$ AS PTR, _ Days AS LONG, Result AS VOID ' "DBADDDATE", StartDate$ AS PTR, AddDate$ AS PTR,Days AS LONG, Result AS VOID ' (from LBCheat.INC.BAS) if DBerror("DBADDDATE") then goto [ProgramEnd] DBaddDate$=stripped$(AddDate$) end function function DBdaysApart(DateFrom$, DateTo$) DateFrom$ = trim$(DateFrom$) + chr$(0) DateTo$ = trim$(DateTo$) + chr$(0) CallDll #DBF, "DBDAYSAPART", DateFrom$ AS PTR, DateTo$ AS PTR, _ DBdaysApart AS LONG if DBerror("DBDAYSAPART") then goto [ProgramEnd] end function function DBerror(ErrorNote$) CallDll #DBF, "DBERROR", ErrorCode as Long select case ErrorCode case 0 DBerror=0 exit function case else notice "DB Error "+str$(ErrorCode)+chr$(13)+ErrorNote$ DBerror=ErrorCode end select CallDll #DBF,"DBRESETERROR", result as Void end function function stripped$(a$) a$=trim$(a$) if right$(a$,1)=chr$(0) then a$=left$(a$,len(a$)-1) stripped$=trim$(a$) end function
|
StartDate$ = trim$(StartDate$) + chr$(0) CallDll #DBF, "DBADDDATE", StartDate$ AS PTR, AddDate$ AS PTR, _ Days AS LONG, Result AS VOID
StartDate$ = trim$(StartDate$) + chr$(0) AddDate$ = space$(MAX.DATE.LENGTH) + chr$(0) CallDll #DBF, "DBADDDATE", StartDate$ AS PTR, AddDate$ AS PTR, _ Days AS LONG, Result AS VOID