Code:
'pbread.bas 'Visual Basic declaration DECLARE SUB Rsvb LIB "OTSW32.DLL" ALIAS "s_1raat" (BYVAL func AS LONG, BYVAL IoArea AS STRING, IOAreaLen AS DWORD, retcode AS LONG) 'C 'extern _declspec(dllexport) void _stdcall WINAPI s_1raat(unsigned int,LPSTR,LPINT,LPINT) FUNCTION PBMAIN AS LONG DIM func AS DWORD DIM controlstatement AS STRING DIM IoArea AS STRING DIM IoAreaLen AS LONG DIM RetCode AS DWORD DIM Testdata AS STRING DIM sDummy AS STRING IoArea = SPACE$(80) func = 1 controlStatement = "S(1,2,C,A) ? "controlstatement ";controlstatement LSET IoArea = controlStatement IoAreaLen = LEN(controlstatement) CALL RSVB(Func,IOArea,IoAreaLen,RetCode) IF retcode <> 0 THEN ? "Unable to init simple test" ELSE ? "Opttech init successful" END IF func = 2 'give 2 values to the sort IoAreaLen = 2 sDummy = "99" LSET Ioarea = sDummy CALL RSVB(Func,IOArea,IoAreaLen,RetCode) IF retcode <> 0 THEN ? "Retcode giving first record";Retcode: GOTO EndPgm ? "First record passed"IoAreaLen sDummy = "01" LSET IoArea = sDummy CALL RSVB(Func,IOArea,IoAreaLen,RetCode) IF retcode <> 0 THEN ? "Error giving record";Retcode:GOTO EndPgm ? "Second record passed" func = 3 DO CALL RSVB(Func,IOArea,IoAreaLen,RetCode) IF retcode >0 THEN EXIT DO ? "Returned: " ; MID$(IoArea,1,IoAreaLen) LOOP EndPgm: ? "Last retCode was";RetCode ? "Press any key to end" WAITKEY$ END FUNCTION ' 'Results wanted: '01 '99 'Result obtained: '01 '01
Comment