Tsunami Record Manager

Just starting out? Need help? Post your questions and find answers here.
Leo
User
User
Posts: 21
Joined: Sat Aug 02, 2003 8:48 pm
Location: Netherlands, Wijk bij Duurstede

Tsunami Record Manager

Post by Leo »

I succeeded in calling the Tsunami Record Manager from Pure Basic. The point is that of the available API's, the String API does not work in PB. I wrote a quick and dirty program with the Pointer-Based API #2

Code: Select all

Structure FileDef
  op.l            
  hFile.l         
  dataptr.l       
  datalen.l       
  keyptr.l        
  keylen.l       
  keyno.l         
EndStructure

DefType.FileDef tsuUDT

OpenResult.l = OpenLibrary(1, "TRM.DLL") 
If OpenResult 
  FuncResult.l = IsFunction(1, "trm_udt") 
  If FuncResult 
    MessageRequester("Info","TRM function is available: "+"trm_udt "+Str(FuncResult),#MB_ICONWARNING) 
    FileName$="C:\TRMDEMO.DAT"
    tsuUDT\op = 0  ; trm_Open
    tsuUDT\keyptr = @FileName$ 
    tsuUDT\keylen = Len(FileName$)
    tsuUDT\keyno = 1 ; Multi-user modeElse 
    If OpenLibrary(10, "trm.dll")
      MessageRequester("Information", "Version : "+Str(CallFunction(10,"trm_Version")), 0)
      MessageRequester("Information","Number of Functions : "+Str(CountLibraryFunctions(10)),0)
      Result.l=CallFunction(10, "trm_udt", @tsuUDT) 
      MessageRequester("Information","filehandle : " +Str(Result.l),0)  
      If Result.l = 0
        Recd$=Space(300) 
        tsuUDT\op = 12 ; trm_GetFirst
        tsuUDT\dataptr = @Recd$
        tsuUDT\datalen = 300
        tsuUDT\keyno = 1    ;CurrKeyPath
        Result.l=CallFunction(10, "trm_udt", @tsuUDT) 
        If Result.l = 0
          MessageRequester("Information",Recd$,0)  
        Else
          MessageRequester("Information","Read of First failed",0)  
        EndIf
      EndIf
    EndIf 
  EndIf 
Else 
  MessageRequester("Error","Tsunami Record Manager not available.",#MB_ICONERROR) 
EndIf 
Succes

Leo
User avatar
blueb
Addict
Addict
Posts: 1111
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Post by blueb »

Thanks Leo,

This will give me a starting point.

Thanks :P

--blueb
Post Reply