Use the Window API to get the path with a API dialog.

' ***********************

Include "MAPBASIC.DEF"

Define BIF_RETURNONLYFSDIRS   1
Define BIF_DONTGOBELOWDOMAIN  2
Define MAX_PATH               260

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

Declare Function APIBrowseFolders(ByVal szTitle as string) as string
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

Declare Sub Main

Sub Main

     Dim lpIDList, retVal As Integer
     Dim sBuffer As String
     Dim tBrowseInfo As BrowseInfo

     tBrowseInfo.hWndOwner = SystemInfo(SYS_INFO_MAPINFOWND)
     tBrowseInfo.lpszTitle = "Your 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

End Sub

' ***********************


Jakob Lanstorp, Computing Geologist

Kampsax   GIS Software & Solutions, Rugaardsvej 55, 5000 Odense, DK
tel: + 45 63 13 50 13, dir: + 45 63 13 50 11, fax: + 45 63 13 50 90
mailto:[EMAIL PROTECTED] , http://www.kampsax-gis.dk, http://www.kampsax.dk
Authorized MapInfo Partner & Distributor in Denmark and Norway
***Visit http://www.kortal.dk and see Denmark from above

----- Videresendt af Jakob Lanstorp/Kampsax - 28-01-02 15:26 -----
                                                                                       
                                         
                    andrew.newman@english-nature.                                      
                                         
                    org.uk                               Til:    
[EMAIL PROTECTED]                              
                    Sendt af:                            cc:                           
                                         
                    [EMAIL PROTECTED]        Vedr.:  MI-L Finding a folder 
                                         
                    onsmag.com                                                         
                                         
                                                                                       
                                         
                                                                                       
                                         
                    28-01-02 13:11                                                     
                                         
                    Besvar venligst til                                                
                                         
                    andrew.newman                                                      
                                         
                                                                                       
                                         
                                                                                       
                                         



Hello Everyone

I am writing a MapBasic Application which will query data, then create new
tables from these queries and store them to a specified folder.  I have got
my queries to work and can save the resulting tables to a specified
(hard-oded) folder no problems...

But what I want to do now is extend the functionality so the user can pick
a folder to store the resulting tables in...

I have discovered that i can get a folder path by browsing to a tab file in
a folder, selecting it, then stripping the 'xxx.tab' bit off the end of the
string to leave just the folder, but what if the user wants to browse to an
empty folder how can i get the path of that?

Thanks for your help
Andrew



This E-mail and any files transmitted with it are private and intended
solely for the use of the individual or entity to whom they are addressed.
If you are not the intended recipient, the E-mail and any files have been
transmitted to you in error and any copying, distribution or other use of
the information contained in them is strictly prohibited.

Nothing in this E-mail message amounts to a contractual or other legal
commitment on the part of English Nature unless confirmed by a signed
communication.

English Nature will make every effort to keep its network free of viruses.
However, the recipient of this message will need to scan this message, and
any attachments, for viruses, as English Nature can take no responsibility
for any computer virus that might be transferred by this e-mail.



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.






_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to