Code:
' TrIDLib PowerBASIC Demo ' [url]http://mark0.net/code-tridlib-e.html[/url] #DIM ALL #INCLUDE "TrIDLib-Const.inc" #INCLUDE "TrIDLib-Funct.inc" FUNCTION PBMAIN LOCAL ret AS LONG LOCAL szBuf AS ASCIIZ * 4096 LOCAL ResNum AS LONG LOCAL ResId AS LONG LOCAL sOut$, MyFile$ MyFile$ = "triddefs.trd" ' a random file to analyze ret = TrID_LoadDefsPack("") ' load the definitions package (TrIDDefs.TRD) from current path ret = TrID_SubmitFileA((MyFile$)) ' submit the file ret = TrID_Analyze() ' perform the analysis IF ret THEN ResNum = TrID_GetInfo(%TRID_GET_RES_NUM, 0, szBuf) ' get the number of results IF ResNum = 0 THEN sOut$ = "Unknown filetype!" ELSE FOR ResId = 1 TO ResNum ' cycle trough the results Ret = TrID_GetInfo(%TRID_GET_RES_FILETYPE, ResId, szBuf) ' get filetype descriptions sOut$ = sOut$ & STR$(ResId)& ":" & $TAB & szBuf Ret = TrID_GetInfo(%TRID_GET_RES_FILEEXT, ResId, szBuf) ' get filetype extensions sOut$ = sOut$ & " (" & szBuf & ")" Ret = TrID_GetInfo(%TRID_GET_RES_POINTS, ResId, szBuf) ' get the matching points sOut$ = sOut$ & " -" & STR$(Ret) sOut$ = sOut$ & $CRLF NEXT ResId END IF msgbox sOut$ ELSE msgbox "Error(s) occurred!", , "TrID_Analyze" END IF END FUNCTION
Comment