I was getting quite interested with the provided code when I read the last
line:

>>>>Note this VB code will have to be converted to MB code first(!).<<<<

That, I had suspected. My problem is that, not knowing all the subtleties of
VB, I have not yet been able to do it. I have found ways to get around some
problems, but some remain that I cannot figure out.

My query is simple: does it exist any information on the "rules" and "means"
to convert VB code to MapBasic? I would love to "collect" them and put them
in some accessible form for public reference if that does not exist yet.

Any material would do. We could very well start with this code as en example
of "conversion". Thanks a lot.

Jacques

Jacques PARIS

e-mail  (>>>19.12.00)  [EMAIL PROTECTED]

For MapInfo support, see the Paris PC Consult enr. site  at
http://www.total.net/~rparis/gisproducts.htm

For MapBasic questions see the J.Paris site at
http://www.total.net/~jakesp/index.htm

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Martin,
Christopher (WSA Telford)
Sent: February 7, 2001 8:29 AM
To: 'Søren Breddam'; MapInfo-L (E-mail)
Subject: RE: MI-L Specifying path

You could always use the Win32 API...

I have other means to do it in VB but the SHBrowseForFolder API function
should do it..

Private Type BrowseInfo
    hWndOwner As Long
    pIDLRoot As Long
    pszDisplayName As Long
    lpszTitle As Long
    ulFlags As Long
    lpfnCallback As Long
    lParam As Long
    iImage As Long
End Type
Const BIF_RETURNONLYFSDIRS = 1
Const MAX_PATH = 260
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal
lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As
BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As
Long, ByVal lpBuffer As String) As Long
Private Sub Form_Load()
    Dim iNull As Integer, lpIDList As Long, lResult As Long
    Dim sPath As String, udtBI As BrowseInfo

    With udtBI
        'Set the owner window
        .hWndOwner = Me.hWnd
        'lstrcat appends the two strings and returns the memory address
        .lpszTitle = lstrcat("C:\", "")
        'Return only if the user selected a directory
        .ulFlags = BIF_RETURNONLYFSDIRS
    End With

    'Show the 'Browse for folder' dialog
    lpIDList = SHBrowseForFolder(udtBI)
    If lpIDList Then
        sPath = String$(MAX_PATH, 0)
        'Get the path from the IDList
        SHGetPathFromIDList lpIDList, sPath
        'free the block of memory
        CoTaskMemFree lpIDList
        iNull = InStr(sPath, vbNullChar)
        If iNull Then
            sPath = Left$(sPath, iNull - 1)
        End If
    End If

    MsgBox sPath
End Sub


Note this VB code will have to be coverted to MB code first(!).

CJM



_______________________________________________________________________
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