VB6 - Declaring and calling C DLL with pointers

后端 未结 2 793
清歌不尽
清歌不尽 2021-01-20 05:07

I have an old C DLL I use to call from Ruby, but now I need to call it from VB6 and I can\'t figure out the correct way to do so.

Here is the header for the function

2条回答
  •  广开言路
    2021-01-20 05:53

    Air code

    Private Declare DecrunchGetLength Alias "Decrunch" Lib "somedll.DLL" (ByRef src As Byte, ByVal nullptr As Long, ByVal SrcLength As Long) As Long 
    
    Private Declare Decrunch Alias "Decrunch" Lib "somedll.DLL" (ByRef src As Byte, ByRef dest As Byte, ByVal SrcLength As Long) As Long 
    
    Dim destLen As Long
     Dim src(0 To 9) As Byte 
    Dim dest() As Byte 
    
    ' get bytes into src somehow 
    
    ' get dest length 
    destLen = DecrunchGetLen( src(0), 0, 10) 
    
    ReDim dest(0 To destLen - 1) 
    destLen = Decrunch( src(0), dest(0), 10) 
    

    Useful links

    • Declare statement
    • Advanced calling C DLLs from VB5/VB6

提交回复
热议问题