Jump to content

Simplier folder selection interface wanted


Recommended Posts

I wrote an application a few years ago and now I am trying to update it. One part of the script is to select a folder. In the older (compiled) version, I get a this interface:

Browse_For_Folder.jpg

However, when I run the script now, it shows a more modern folder selection function that has a sidebar and more options. I have played with the flags listed in the help file and I cannot get the simple look as the screenshot I posted above. Does anyone know how I can get that dialog back?

Thanks!

 

Link to comment
Share on other sites

Hello. try this.

Local $sFolder = _FileSelectFolder("Choose Folder")
ConsoleWrite($sFolder & @CRLF)
Func _FileSelectFolder($title, $root = 0, $flags = 0, $hwnd = 0)
    Local $ret, $pidl, $res = ''
    Local $ubi = DllStructCreate("hwnd;ptr;ptr;ptr;int;ptr;ptr;int")
    Local $utl = DllStructCreate("char[512]")
    Local $urs = DllStructCreate("char[260]")
    Local $ulf = BitOR(BitShift(BitAND($flags, 1), -9), _
            BitShift(BitAND($flags, 2), -5), _
            BitShift(BitAND($flags, 4), -2))
    DllStructSetData($utl, 1, $title)
    DllStructSetData($ubi, 1, $hwnd)
    DllStructSetData($ubi, 3, DllStructGetPtr($urs))
    DllStructSetData($ubi, 4, DllStructGetPtr($utl))
    DllStructSetData($ubi, 5, $ulf)
    $ret = DllCall("shell32.dll", "ptr", "SHGetSpecialFolderLocation", _
            "int", 0, _
            "int", $root, _
            "ptr", DllStructGetPtr($ubi, 2))
    If $ret[0] Then Return $res
    $pidl = DllCall("shell32.dll", "ptr", "SHBrowseForFolder", "ptr", DllStructGetPtr($ubi))
    If $pidl[0] Then
        $ret = DllCall("shell32.dll", "int", "SHGetPathFromIDList", _
                "ptr", $pidl[0], _
                "ptr", DllStructGetPtr($urs))
        If $ret[0] Then $res = DllStructGetData($urs, 1)
        DllCall("ole32.dll", "int", "CoTaskMemFree", "ptr", $pidl[0])
    EndIf
    DllCall("ole32.dll", "int", "CoTaskMemFree", "ptr", DllStructGetData($ubi, 2))
    Return $res
EndFunc   ;==>_FileSelectFolder

Saludos

Link to comment
Share on other sites

You're welcome. the funny part is that you saw the thread some years ago 

 

Saludos

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...