How do you declare this C DLL function in VB? - uses a long pointer

  • Thread starter Thread starter Angus
  • Start date Start date
A

Angus

Hello

I have a function in a C DLL like this:

DWORD __stdcall FCSConnect(const TCHAR * ServerName, UINT
ServerPort,
FCS_HANDLE * FCSHandle);

My interpretation in VB is (VB6):

Private Declare Function FCSConnect Lib "C:\FCS\FCSAPI\Release
\FCSAPI.dll" (ByVal szServername As String, ByVal lPort As Long, ByVal
hFCSHandle As Long) As Long


But it doesn't work.

All the other functions work ok but for this one the last parameter is
a pointer - FCS_HANDLE. Do I need to use addressOf or anything
different?
 
Hello

I have a function in a C DLL like this:

DWORD __stdcall FCSConnect(const TCHAR * ServerName, UINT
ServerPort,
FCS_HANDLE * FCSHandle);

My interpretation in VB is (VB6):

Private Declare Function FCSConnect Lib "C:\FCS\FCSAPI\Release
\FCSAPI.dll" (ByVal szServername As String, ByVal lPort As Long, ByVal
hFCSHandle As Long) As Long

But it doesn't work.

All the other functions work ok but for this one the last parameter is
a pointer - FCS_HANDLE. Do I need to use addressOf or anything
different?

I worked it out - for a pointer you use ByRef rather than ByVal -
worked for me anyway.
 
Back
Top