• 0

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


mijq
Go to solution Solved by Tetus,

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 post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

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 post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now