Kalu
This is probably one of the places where you need to replace some of the Integer variables with the new variable type introduced in MapBasic 12.5.1: IntPtr
I have already struggled a bit with this with the WinAPI functions for finding files where I needed to change some of them into IntPtr. The trick is to figure out which needs to get changed and which don't
Declare Function WAPIFindFirstFile Lib "kernel32" Alias "FindFirstFileA"
( ByVal lpFileName As String
, lpFindFileData As WIN32_FIND_DATA
) As IntPtr
Declare Function WAPIFindNextFile Lib "kernel32" Alias "FindNextFileA"
( ByVal hFindFile As IntPtr
, lpFindFileData As WIN32_FIND_DATA
) As Integer
Declare Function WAPIFindClose Lib "kernel32" Alias "FindClose"
( ByVal hFindFile As IntPtr
) As Integer
I got this tip from one of our software engineers after blindly having replaced all Integers with IntPtrs:
However, definitely do NOT change all the Integer types
to IntPtr. If, in the API function definition, the type should be
Integer, then leave it as Integer. However, for Windows API types like
long pointers (which generally have a prefix of lp), HANDLE, and some
others whose values will (or can) vary depending upon whether it is a 32-bit or
a 64-bit architecture, these should be IntPtr. With the functions below,
FindNext and FindClose should still return an Integer. However, FindFirst
is returning a HANDLE, which is then passed to FindNext. This handle needs to
be declared as IntPtr in MapBasic.
Consider this a headsup for those of you who are working with the WinAPI and looking to move onto the 64bit version.
Also note that the IntPtr isn't supported in MapBasic versions earlier than 12.5.1
Peter Horsbøll Møller
Pitney Bowes Software