From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling LV DLL from VB

I have a vi that initializes, measures, and releases
an OSA instrument. I want to call this routine from VB.
I used Standard calling convention when making DLL from LV.


Here is my VB declaration:

Private Declare Sub OSAMeasurement Lib "C:\ADE\OSAMeasurement.dll" Alias "OSADFBMeasurement" _
(ByVal GPIB As Long, _
ByVal Serial_Number As String, _
ByVal FileName As String, _
ByVal File_Path As String, _
ByVal Start_Wavelength_nm As Double, _
ByVal Stop_Wavelength_nm As Double, _
ByVal Level_Scale_dB As Double, _
ByVal Res_nm As Double, _
ByVal Peak_Wavelength As Double, _
ByVal Peak_Level As Double, _
ByVal SMSR As Double, _
ByVal FWHM As Double, _
ByVal Mode_Offset As Double, _
ByRef Level_Array() As Double, _
ByRef Wa
velength_Array() As Double, _
ByVal Array_Length As Long)


Here is my VB call:

Call OSAMeasurement(Form1.OSA.PrimaryAddress, _
(strOXM & Form1!txtOPMNumber), _
(CStr(CInt(dblSetVoltage)) & "v_Scan.txt"), _
(txtDataStoragePath & strOXM & " " & Form1!txtOPMNumber & "\"), _
1520, 1620, 5, 1, Peak_Wavelength, Peak_Level, _
SMSR, FWHM, Mode_Offset, _
Level_Array, Wavelength_Array, 1001)


I get RunTime Error "49"
Bad DLL calling convention

What is wrong?
Any suggestions/comments?
0 Kudos
Message 1 of 1
(3,027 Views)