problems with parameter of a function in a dll

S

Stijn

I have a dll that I use to communicate with a device. I
try to use one off the functions but always get the same
erro: Object reference not set to an instance of an
object.

This is the declaration of my function

Private Declare Function SCN_Open_Device
Lib "scn_scsi.dll" Alias "SCN_Open_Device" (ByVal hWnd As
IntPtr, ByVal num_device As Int16, ByVal vendor_model As
String, ByVal product_version As String, ByVal
periph_name As String, ByVal path_ini_file As String,
ByVal dll_version As Int16) As String

And I use it in this way

Dim str As String
Dim name As String = ""
Dim manufact As String = ""
Dim b As Byte = 0
Dim sh As Short = 0
hwnd = FindWindow(nothing, myParent.Name)
str = SCN_Open_Device(hwnd, b, manufact,
name, "*", "scn_dll.ini", sh)

-hwnd is the handle of the application window [in]
-b specifies tht number of host adapters installed [out]
-manufact must be a pointer to a buffer that contains the
name of the peripheral manufacturer [out]
-name is a pointer to a buffer that contains the version
of the model [out]
-"*" the function Search automatically the connected type
peripherals. [in]
-"scn_dll.ini" ini-file used by the device [in]
-sh contains de dll version [out]

Does someone knows what I'm doing wrong?
 
M

Mattias Sjögren

Stijn,
I have a dll that I use to communicate with a device. I
try to use one off the functions but always get the same
erro: Object reference not set to an instance of an
object.

Can you post the corresponding native declaration (in C++ or whatever)
of the function? I doubt that the return type can be String.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top