Creating Directories using 64 bit MapBasic

65 views
Skip to first unread message

Richard Robinson

unread,
Sep 14, 2016, 4:55:20 AM9/14/16
to MapInfo-L

 

 The following code works with the 32 bit Mapbasic compiler, however, when compiled with the 15.2 version (64 bit) it no longer works.
 
Any suggestion greatly appreciated, it simply creates an additional subdirectory beneath where the existing file is located.

Include "MapBasic.def"

Type SECURITY_ATTRIBUTES

nLength as integer 'DWORD in Windows

lpSecurityDescriptor as integer 'LPVOID in Windows

bInheritHandle as integer 'BOOL in Windows

End type

Declare function CreateDirectory32 lib "Kernel32.dll" alias "CreateDirectoryA"

(byval aPath as string, tSecurity as SECURITY_ATTRIBUTES) as integer

Dim tSecurity as SECURITY_ATTRIBUTES

Declare Sub Main()

Sub main()

DIM iStatus As Integer

DIM sPath1, sTabFP, sTabFN, sTABDr, sTabSN, sTabN as String

sTabFP = FileOpenDlg("","","TAB","Locate Exported TAB Files") 'Locates directory containing files

sTabDR = PathToDirectory$(sTabFP)

sTabFN = PathToFileName$(sTabFP)

sTabN = Left$(sTabFN,len(sTabFN)-4)

tSecurity.nLength = 200

sPath1 = sTabDR+"LOGs"

iStatus = CreateDirectory32 (sPath1, tSecurity)

End Sub

 

Eric Blasenheim

unread,
Sep 14, 2016, 6:27:54 PM9/14/16
to MapInfo-L
Look at the new documentation. You may need to use the new "IntPtr" type as some of those Integer values are probably now 64 bits rather than 32. That LPVOID is a sure candidate. 
We do handle strings automatically, but with Integer having double duty as both a real 32 bit integer and use as a placeholder for a pointer, the code can't tell for sure. 
Regards,
Eric Blasenheim
Pitney Bowes Software
Reply all
Reply to author
Forward
0 new messages