DLLを使用したサンプルプログラムの記述例を,関数ごとに次に示します。
Declare Function ReportPrint Lib "hieur20.dll" (ByVal hWnd As Integer, ByVal ReportFileName As String, ByVal OptionFileName As String, ByVal WindowStyle As Integer) As Integer
' 帳票確認ウィンドウを表示する関数の宣言
Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click
Dim strRptFileName As String
Dim lngEurResultCode As Integer
strRptFileName = "納品書.fms" '帳票ファイルを指定
lngEurResultCode = ReportPrint(Me.Handle.ToInt32, strRptFileName, vbNullString, 2)
'帳票をプリンタへ印刷
If lngEurResultCode <> 0 Then MsgBox("エラーが発生しました" & lngEurResultCode)
End Sub
Declare Function ReportPrintWithView Lib "hieur20.dll" (ByVal hWnd As Integer, ByVal ReportFileName As String, ByVal OptionFileName As String, ByVal WindowStyle As Integer) As Integer
'帳票印刷ウィンドウを表示する関数の宣言
Private Sub Command2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command2.Click
Dim strRptFileName As String
Dim lngEurResultCode As Integer
strRptFileName = "納品書.fms" '帳票ファイルを指定
lngEurResultCode = ReportPrintWithView(Me.Handle.ToInt32, strRptFileName, vbNullString, 1)
'帳票印刷ウィンドウを表示
If lngEurResultCode <> 0 Then MsgBox("エラーが発生しました" & lngEurResultCode)
End Sub