Jump to content
  • 0

vb.net and/or c#.net wrapper for dwf.dll


mijq

Question

Just downloaded Waveforms and would like to use the dwf.dll in a vb.net program. When trying to include the dll as a reference I get an error that it is not recognized as a valid COM component or assembly.

Do you have a compatible wrapper or other suggestion?

 

Regards mijq

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Got a little further:

Imports System.Runtime.InteropServices

Public Class frmMain
    <DllImport("dwf.dll")>
    Public Shared Function FDwfDeviceOpen(ByVal idxDevice As Integer, ByRef phdwf As IntPtr) As Integer
    End Function
    Dim hdwf As IntPtr
    Private Sub frmMain_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Try
            FDwfDeviceOpen(-1, hdwf)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub
End Class

 

It seems that the <DllImport..> works, but the program throws an exception: 

A call to PInvoke function 'testAnalogDiscovery2!testAnalogDiscovery2.frmMain::FDwfDeviceOpen' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

 

Please advise

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...