Hello,
>Hey - is there an easy way to call a directory picker like in
>MapInfo's Options | Preferences | Directories?
>My app currently uses the FileOpenDlg() and instructs
>the user to "point to a file in the directory you want..." and
>then the code uses the PathToDirectory$() function.
>Anyway, is there an easy way to call a directory picker
>for instance through an API or something without resorting
>to VB?
>(Also, why do so many people use Delphi with MI instead
>of VB? Is there an advantage?)
I was posting this to the list some time ago. Here is the solution:
Include "MapBasic.def"
Type BROWSEINFO
hwndOwner as Integer
pidlRoot As Integer
pszDisplayName As String
lpszTitle As String
ulFlags As Integer
lpfn As Integer
lParam As Integer
iImage As Integer
End Type
Declare Function SHBrowseForFolder Lib "shell32.dll" (bi As BROWSEINFO) As Integer
Declare Function SHGetPathFromIDList Lib "shell32.dll" (ByVal pidl As Integer, szPath
As String) As Integer
Dim r As Integer, bi As BROWSEINFO, s As String
s = Space$(260)
bi.hwndOwner = SystemInfo(SYS_INFO_MAPINFOWND)
bi.pidlRoot = 0
bi.pszDisplayName = s
bi.lpszTitle = "Default Data Folder"
bi.ulFlags = 1
bi.lpfn = 0
bi.lParam = 0
bi.iImage = 0
r = SHBrowseForFolder(bi)
If r <> 0 Then
r = SHGetPathFromIDList(r, s)
End If
Print s
Read API documentation to learn more about SHBrowseForFolder function and BROWSEINFO
structure.
Dmitry
Dmitry Bogdanov
GIS Department Manager
Kiev Software Factory Ltd.
room 46 9/12 Baumana St, Kiev, Ukraine 252190
Tel: (380 44) 442-6077; (380 44) 443-7925
Fax: (380 44) 443-7925
Internet: http://www.ksf.kiev.ua
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]