おはようございます。
私がテストしたコードをそのまま書きます。
Formを1つ、そこにButtonを一つ貼り付けます。
オープン/クローズ、レコード数取得、hdbからの読み出し(詳細は書きませんでしたが)
もできています。
Public Class Form1
Declare Function dbf_open Lib "Hamlog50.dll" (ByVal s As String, ByRef d As TDBFh) As Integer
Declare Sub dbf_close Lib "Hamlog50.dll" (ByRef d As TDBFh)
Declare Function dbf_rcount Lib "Hamlog50.dll" (ByRef d As TDBFh) As Integer
Declare Function Vdbf_open Lib "Thdll2Vb.dll" (ByVal s As String, ByRef d As TThLog) As Integer
Declare Sub Vdbf_close Lib "Thdll2Vb.dll" (ByRef d As TThLog)
Declare Function Vdbf_rcount Lib "Thdll2Vb.dll" (ByRef d As TThLog) As Integer
Declare Function HamlogOpen Lib "Hamlog50.dll" (ByVal h As Integer, ByRef th As TThLog, ByVal f As String, ByVal v As Integer) As Integer
Declare Sub HamlogClose Lib "Hamlog50.dll" (ByRef th As TThLog, ByVal i As Integer)
Declare Function ThwString Lib "Thdll2Vb.dll" (ByVal s As String, ByRef th As TThLog, ByVal n As Short) As Integer
Declare Function THW_read Lib "Hamlog50.dll" (ByRef h As TThLog, ByVal n As Integer, ByVal i As Integer) As Integer
Structure TDBFh
<VBFixedArray(4), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=4)> Dim lupdt() As Byte
Dim Rcount As Integer
Dim hsize As Integer
Dim recnm As Integer
Dim fHdl As Integer
<VBFixedArray(260), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=260)> Dim Temp() As Byte
Public Sub Initialize()
ReDim lupdt(4)
ReDim Temp(260)
End Sub
End Structure
Structure TThLog
<VBFixedArray(3927), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=3927)> Dim Qso() As Byte ' Ver5.03で変更
Public Sub Initialize()
ReDim Qso(3927)
End Sub
End Structure
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sd As Integer
Dim recno As Integer
Dim tdbfh As TDBFh
Dim th As TThLog
Dim f As String
f = "C:\Hamlog.hdb"
sd = dbf_open(f, tdbfh)
recno = dbf_rcount(tdbfh)
dbf_close(tdbfh)
sd = Vdbf_open(f, th)
recno = Vdbf_rcount(th)
Vdbf_close(th)
sd = HamlogOpen(0, th, f, 0)
Call HamlogClose(th, 1)
End Sub
End Class