VB.Net Pointer!!! Help me please!

G

Guest

1, Use API function in VB.net
This is head file in C:
int WINAPI SsmGetAutoCallDirection(int ch, int* pnDirection);

2, I can run the code in VB6 like this:
Public Declare Function SsmGetAutoCallDirection Lib "SHP_A3.dll" (ByVal ch As Long, ByRef pnDirection As Long) As Long

3,I can't run the code in Vb.net

Help me please!!!!
 
T

Tom Shelton

Danny said:
1, Use API function in VB.net
This is head file in C:
int WINAPI SsmGetAutoCallDirection(int ch, int* pnDirection);

2, I can run the code in VB6 like this:
Public Declare Function SsmGetAutoCallDirection Lib "SHP_A3.dll" (ByVal ch
As Long, ByRef pnDirection As Long) As Long

3,I can't run the code in Vb.net

Help me please!!!!


Long in VB.NET is 64-bit. You should use Integers....

Public Declare Function SsmGetAutoCallDirection Lib "SHP_A3.dll" (ByVal ch
As Integer, ByRef pnDirection As Integer) As Integer
 
G

Guest

Thank you,But My question is "Pointer",Not int32 and int64

I try it by your way ,but not access it !
 
T

Tom Shelton

Thank you,But My question is "Pointer",Not int32 and int64

I try it by your way ,but not access it !

Danny,

I was simply translating the VB6 code into VB.NET. It works exactly the
same way - except for the data types sizes. You were passing a long
byref in VB6 - so I passed a integer byref? Maybe you should show some
code actually using this API call.
 

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