C Dll pointers arguments

  • Thread starter Thread starter marfi95
  • Start date Start date
M

marfi95

I have to interface with a C Dll (not mine, 3rd party) that I have no
vb.net declares for, so I'm having to create them. I'm having a little
trouble translating some of the types.

The C Dll call:

int LS1 (HWND hwnd, HANDLE hInst, SHORT s1, SHORT *s2);

I am having trouble translating the pointer to s2. I get an error on
the call (something about an object not instantiated), so I'm not sure
its related to my declare or not, but its in the call.

my declare:

Declare Function LS1 Lib "lsx.dll" (ByVal hWnd As IntPtr, ByVal hInst
As IntPtr, ByVal s1 As Int16, ByVal hConnect As IntPtr) As Int16

I'm not sure how to handle the SHORT *s2 pointer. Is what I have the
correct way to do it ? Does it have to be initialized or something
first ?

Any ideas would be appreciated.

TIA,
Mark
 
I have to interface with a C Dll (not mine, 3rd party) that I have no
vb.net declares for, so I'm having to create them. I'm having a little
trouble translating some of the types.

The C Dll call:

int LS1 (HWND hwnd, HANDLE hInst, SHORT s1, SHORT *s2);

I am having trouble translating the pointer to s2. I get an error on
the call (something about an object not instantiated), so I'm not sure
its related to my declare or not, but its in the call.

my declare:

Declare Function LS1 Lib "lsx.dll" (ByVal hWnd As IntPtr, ByVal hInst
As IntPtr, ByVal s1 As Int16, ByVal hConnect As IntPtr) As Int16

Declare Function LS1 Lib "lsx.dll" _
(ByVal hWnd As IntPtr, _
ByVal hInst As IntPtr, _
ByVal s1 As Int16, _
ByRef s2 As Int16) As Int32
 

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

Back
Top