VB.Net Pointer!!! Help me please!

  • Thread starter Thread starter Guest
  • Start date Start date
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!!!!
 
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
 
Thank you,But My question is "Pointer",Not int32 and int64

I try it by your way ,but not access it !
 
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.
 
Back
Top