How to use wrapped GUI dll in VB.NET??

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello
I have found on that web site http://www.oscilloscope-lib.com/
<span style="color:#0066dd http://www.oscilloscope-lib.com/ a dll library that seem to plot data at high speed.
There are many example except that VB.NET.....
There is anyone that could help me to start to use this dll in vb.net?
I need to understand how place graph on form and how draw at lest 1 point
Thanks


Here the automatic translation of wrapper:


<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; Namespace Signal_Project
<span style="color:Blue; NotInheritable <span style="color:Blue; Class Oscilloscope
<span style="color:Blue; Implements IDisposable

<span style="color:Blue; #Region <span style="color:#A31515; "External declarations"

<span style="color:Green;
<span style="color:Green; * C-style function declarations
<span style="color:Green; *
<span style="color:Green; int (__cdecl * AtOpenLib) (int Prm);
<span style="color:Green; int (__cdecl * ScopeCreate) (int Prm , char * P_IniName, char * P_IniSuffix);
<span style="color:Green; int (__cdecl * ScopeDestroy) (int ScopeHandle);
<span style="color:Green; int (__cdecl * ScopeShow) (int ScopeHandle);
<span style="color:Green; int (__cdecl * ScopeHide) (int ScopeHandle);
<span style="color:Green; int (__cdecl * ScopeCleanBuffers) (int ScopeHandle);
<span style="color:Green; int (__cdecl * ShowNext) (int ScopeHandle, double * PArrDbl);
<span style="color:Green; int (__cdecl * ExternalNext) (int ScopeHandle, double * PDbl);
<span style="color:Green; int (__cdecl * QuickUpDate) (int ScopeHandle);
<span style="color:Green;

<DllImport(<span style="color:#A31515; "Osc_DLL.dll", CallingConvention := CallingConvention.Cdecl)> _
<span style="color:Blue; Private <span style="color:Blue; Shared <span style="color:Blue; Function AtOpenLib(Prm <span style="color:Blue; As <span style="color:Blue; Integer) <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; End <span style="color:Blue; Function

<DllImport(<span style="color:#A31515; "Osc_DLL.dll", CallingConvention := CallingConvention.Cdecl)> _
<span style="color:Blue; Private <span style="color:Blue; Shared <span style="color:Blue; Function ScopeCreate(Prm <span style="color:Blue; As <span style="color:Blue; Integer, <MarshalAs(UnmanagedType.LPStr)> P_IniName <span style="color:Blue; As StringBuilder, <MarshalAs(UnmanagedType.LPStr)> P_IniSuffix <span style="color:Blue; As StringBuilder) <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; End <span style="color:Blue; Function

<DllImport(<span style="color:#A31515; "Osc_DLL.dll", CallingConvention := CallingConvention.Cdecl)> _
<span style="color:Blue; Private <span style="color:Blue; Shared <span style="color:Blue; Function ScopeDestroy(ScopeHandle <span style="color:Blue; As <span style="color:Blue; Integer) <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; End <span style="color:Blue; Function

<DllImport(<span style="color:#A31515; "Osc_DLL.dll", CallingConvention := CallingConvention.Cdecl)> _
<span style="color:Blue; Private <span style="color:Blue; Shared <span style="color:Blue; Function ScopeShow(ScopeHandle <span style="color:Blue; As <span style="color:Blue; Integer) <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; End <span style="color:Blue; Function

<DllImport(<span style="color:#A31515; "Osc_DLL.dll", CallingConvention := CallingConvention.Cdecl)> _
<span style="color:Blue; Private <span style="color:Blue; Shared <span style="color:Blue; Function ScopeHide(ScopeHandle <span style="color:Blue; As <span style="color:Blue; Integer) <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; End <span style="color:Blue; Function

<DllImport(<span style="color:#A31515; "Osc_DLL.dll", CallingConvention := CallingConvention.Cdecl)> _
<span style="color:Blue; Private <span style="color:Blue; Shared <span style="color:Blue; Function ScopeCleanBuffers(ScopeHandle <span style="color:Blue; As <span style="color:Blue; Integer) <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; End <span style="color:Blue; Function

<DllImport(<span style="color:#A31515; "Osc_DLL.dll", CallingConvention := CallingConvention.Cdecl)> _
<span style="color:Blue; Private <span style="color:Blue; Shared <span style="color:Blue; Function ShowNext(ScopeHandle <span style="color:Blue; As <span style="color:Blue; Integer, PArrDbl <span style="color:Blue; As <span style="color:Blue; Double()) <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; End <span style="color:Blue; Function

<DllImport(<span style="color:#A31515; "Osc_DLL.dll", CallingConvention := CallingConvention.Cdecl)> _
<span style="color:Blue; Private <span style="color:Blue; Shared <span style="color:Blue; Function ExternalNext(ScopeHandle <span style="color:Blue; As <span style="color:Blue; Integer, <span style="color:Blue; ByRef PDbl <span style="color:Blue; As <span style="color:Blue; Double) <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; End <span style="color:Blue; Function

<DllImport(<span style="color:#A31515; "Osc_DLL.dll", CallingConvention := CallingConvention.Cdecl)> _
<span style="color:Blue; Private <span style="color:Blue; Shared <span style="color:Blue; Function QuickUpDate(ScopeHandle <span style="color:Blue; As <span style="color:Blue; Integer) <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; End <span style="color:Blue; Function

<span style="color:Blue; #End Region

<span style="color:Blue; #Region <span style="color:#A31515; "Static members"
<span style="color:Blue; Shared initialized <span style="color:Blue; As <span style="color:Blue; Boolean = <span style="color:Blue; False

<span style="color:Green; <summary>
<span style="color:Green; Creates a new Oscilloscope. Returns the object if successful,
<span style="color:Green; otherwise returns null. Generally, if it returns null then
<span style="color:Green; it cannot find the correct DLL to load
<span style="color:Green; </summary>
<span style="color:Green; <returns>Oscilloscope instance</returns>
<span style="color:Blue; Public <span style="color:Blue; Shared <span style="color:Blue; Function Create() <span style="color:Blue; As Oscilloscope
<span style="color:Blue; Return Create(<span style="color:Blue; Nothing, <span style="color:Blue; Nothing)
<span style="color:Blue; End <span style="color:Blue; Function

<span style="color:Green; <summary>
<span style="color:Green; Creates a new Oscilloscope. Returns the object if successful,
<span style="color:Green; otherwise returns null. Generally, if it returns null then
<span style="color:Green; it cannot find the correct DLL to load
<span style="color:Green; </summary>
<span style="color:Green; <param name="IniName Name of INI file with scope settings</param>
<span style="color:Green; <param name="IniSuffix Section name suffix (see manual)</param>
<span style="color:Green; <returns>Oscilloscope instance</returns>
<span style="color:Blue; Public <span style="color:Blue; Shared <span style="color:Blue; Function Create(IniName <span style="color:Blue; As <span style="color:Blue; String, IniSuffix <span style="color:Blue; As <span style="color:Blue; String) <span style="color:Blue; As Oscilloscope

<span style="color:Blue; Dim handle <span style="color:Blue; As <span style="color:Blue; Integer

<span style="color:Blue; Try
<span style="color:Blue; If <span style="color:Blue; Not initialized <span style="color:Blue; Then
<span style="color:Green; initialize
<span style="color:Blue; If AtOpenLib(0) = -1 <span style="color:Blue; Then
<span style="color:Blue; Return <span style="color:Blue; Nothing
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Green; set to true
initialized = <span style="color:Blue; True

<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; Catch
<span style="color:Green; return
<span style="color:Blue; Return <span style="color:Blue; Nothing
<span style="color:Blue; End <span style="color:Blue; Try

<span style="color:Green; create the scope
handle = ScopeCreate(0, <span style="color:Blue; New StringBuilder(IniName), <span style="color:Blue; New StringBuilder(IniSuffix))

<span style="color:Blue; If handle <> 0 <span style="color:Blue; Then
<span style="color:Blue; Return <span style="color:Blue; New Oscilloscope(handle)
<span style="color:Blue; End <span style="color:Blue; If

<span style="color:Blue; Return <span style="color:Blue; Nothing
<span style="color:Blue; End <span style="color:Blue; Function

<span style="color:Blue; #End Region

<span style="color:Blue; Private scopeHandle <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; Private _disposed <span style="color:Blue; As <span style="color:Blue; Boolean = <span style="color:Blue; False


<span style="color:Blue; Private <span style="color:Blue; Sub <span style="color:Blue; New()
<span style="color:Blue; End <span style="color:Blue; Sub

<span style="color:Blue; Private <span style="color:Blue; Sub <span style="color:Blue; New(handle <span style="color:Blue; As <span style="color:Blue; Integer)
scopeHandle = handle
<span style="color:Blue; End <span style="color:Blue; Sub

<span style="color:Blue; Protected <span style="color:Blue; Overrides <span style="color:Blue; Sub Finalize()
<span style="color:Blue; Try
Dispose()
<span style="color:Blue; Finally
<span style="color:Blue; MyBase.Finalize()
<span style="color:Blue; End <span style="color:Blue; Try
<span style="color:Blue; End <span style="color:Blue; Sub

<span style="color:Green; <summary>
<span style="color:Green; Shows the scope
<span style="color:Green; </summary>
<span style="color:Blue; Public <span style="color:Blue; Sub Show()
<span style="color:Blue; If <span style="color:Blue; Not _disposed <span style="color:Blue; Then
ScopeShow(scopeHandle)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; End <span style="color:Blue; Sub

<span style="color:Green; <summary>
<span style="color:Green; Hides the scope from view
<span style="color:Green; </summary>
<span style="color:Blue; Public <span style="color:Blue; Sub Hide()
<span style="color:Blue; If <span style="color:Blue; Not _disposed <span style="color:Blue; Then
ScopeHide(scopeHandle)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; End <span style="color:Blue; Sub

<span style="color:Green; <summary>
<span style="color:Green; Clears the buffer of the scope
<span style="color:Green; </summary>
<span style="color:Blue; Public <span style="color:Blue; Sub Clear()
<span style="color:Blue; If <span style="color:Blue; Not _disposed <span style="color:Blue; Then
ScopeCleanBuffers(scopeHandle)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; End <span style="color:Blue; Sub

<span style="color:Green; <summary>
<span style="color:Green; Add data to the scope
<span style="color:Green; </summary>
<span style="color:Green; <param name="beam1 Data for first beam</param>
<span style="color:Green; <param name="beam2 Data for second beam</param>
<span style="color:Green; <param name="beam3 Data for third beam</param>
<span style="color:Blue; Public <span style="color:Blue; Sub AddData(beam1 <span style="color:Blue; As <span style="color:Blue; Double, beam2 <span style="color:Blue; As <span style="color:Blue; Double, beam3 <span style="color:Blue; As <span style="color:Blue; Double)
<span style="color:Blue; If <span style="color:Blue; Not _disposed <span style="color:Blue; Then

<span style="color:Blue; Dim PArrDbl <span style="color:Blue; As <span style="color:Blue; Double() = <span style="color:Blue; New <span style="color:Blue; Double(2) {}
PArrDbl(0) = beam1
PArrDbl(1) = beam2
PArrDbl(2) = beam3

ShowNext(scopeHandle, PArrDbl)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; End <span style="color:Blue; Sub

<span style="color:Green; <summary>
<span style="color:Green; Add data to the external trigger function signal
<span style="color:Green; </summary>
<span style="color:Green; <param name="data The data</param>
<span style="color:Blue; Public <span style="color:Blue; Sub AddExternalData(data <span style="color:Blue; As <span style="color:Blue; Double)
<span style="color:Blue; If <span style="color:Blue; Not _disposed <span style="color:Blue; Then
ExternalNext(scopeHandle, data)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; End <span style="color:Blue; Sub

<span style="color:Green; <summary>
<span style="color:Green; Quickly refreshes screen of oscilloscope. Calling this function is
<span style="color:Green; not usually required. Recommended for using in situations when
<span style="color:Green; intensive data stream is going into oscilloscope
<span style="color:Green; </summary>
<span style="color:Blue; Public <span style="color:Blue; Sub Update()
<span style="color:Blue; If <span style="color:Blue; Not _disposed <span style="color:Blue; Then
QuickUpDate(scopeHandle)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; End <span style="color:Blue; Sub

<span style="color:Blue; #Region <span style="color:#A31515; "IDisposable Members"

<span style="color:Green; <summary>
<span style="color:Green; Dispose the object
<span style="color:Green; </summary>
<span style="color:Blue; Public <span style="color:Blue; Sub Dispose() <span style="color:Blue; Implements IDisposable.Dispose
<span style="color:Blue; If <span style="color:Blue; Not _disposed <span style="color:Blue; Then
ScopeDestroy(scopeHandle)
_disposed = <span style="color:Blue; True
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; End <span style="color:Blue; Sub

<span style="color:Green; <summary>
<span style="color:Green; True if object is already disposed
<span style="color:Green; </summary>
<span style="color:Blue; Public <span style="color:Blue; ReadOnly <span style="color:Blue; Property IsDisposed() <span style="color:Blue; As <span style="color:Blue; Boolean
<span style="color:Blue; Get
<span style="color:Blue; Return _disposed
<span style="color:Blue; End <span style="color:Blue; Get
<span style="color:Blue; End <span style="color:Blue; Property

<span style="color:Blue; #End Region
<span style="color:Blue; End <span style="color:Blue; Class
<span style="color:Blue; End <span style="color:Blue; Namespace
[/code]





View the full article
 
Back
Top