I had to do this previously, I browsed mapinfo-l archives and figured
how to do that. You have to define some constant and the 2 win32 api
function. The FolderOpenDlg is a mapbasic function calling all the
necessary win32 stuff. (mypath=FolderOpenDlg("my title"))


declare function FolderOpenDlg(byval title as string) as string
Type BrowseInfo
        hWndOwner As Integer
        pIDLRoot As Integer
        pszDisplayName As integer
        lpszTitle As String
        ulFlags As Integer
        lpfnCallBack As Integer
        lParam As Integer
        iImage As Integer
End Type
Define BIF_RETURNONLYFSDIRS 1
Define BIF_DONTGOBELOWDOMAIN 2
Define MAX_PATH 260
Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As
Integer
Declare Function SHGetPathFromIDList Lib "shell32" Alias
"SHGetPathFromIDList" (byval pidList As Integer,lpBuffer As String) As
Integer
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''
function FolderOpenDlg(byval title as string) as string
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''
        Dim lpIDList, retVal As Integer
        Dim sBuffer As String
        Dim tBrowseInfo As BrowseInfo
        tBrowseInfo.hWndOwner = SystemInfo(SYS_INFO_MAPINFOWND)
        tBrowseInfo.lpszTitle = title
        tBrowseInfo.ulFlags = BIF_RETURNONLYFSDIRS +
BIF_DONTGOBELOWDOMAIN
        lpIDList = SHBrowseForFolder(tBrowseInfo)
        If (lpIDList) Then
                sBuffer = space$(MAX_PATH)
                retVal = SHGetPathFromIDList(lpIDList, sBuffer)
                'Note sBuffer
        End If
        FolderOpenDlg = sBuffer
end function

-----Original Message-----
From: James Stott [mailto:[EMAIL PROTECTED] 
Sent: December 7, 2004 11:24 AM
To: [EMAIL PROTECTED]
Subject: MI-L Directories

All,
 
I am writing a mapbasic tool that will generate a lot of files, and I
want these to be placed in a user specified directory.
 
Is it possible to give a user the option to specify a directory to place
files in using MapBasic?
 
I have seen it used in other tools, but don't have the source code to
see how it is implemented.
 
I don't want the user to have to specify the file name, only a
directory.
 
James Stott 
  
   
This Electronic Transmission is intended only for the attention of the
addressee. It may contain privileged and confidential information. If
you are not the person for whom it is intended, you must not copy,
distribute or take any action in reliance on it. If you have received
this electronic transmission in error please notify us immediately by
telephone, delete the transmission and destroy any hard copies.  
Nicholas Pearson Associates has used all reasonable efforts to ensure
that this message and any attachments are free from viruses.  
    
 
Nicholas Pearson Associates 
Environmental Planners - Landscape Architects - Ecologists 
30 Brock Street, Bath,BA1 2LN 
Tel: +44 (0) 1225 445548 Fax: +44 (0) 1225 312387  
www.npaconsult.co.uk 
 

 
 


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14406

Reply via email to