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

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?
 
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?

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

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