How to select a folder with native windows dialog box?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • flaus.a@wanadoo.fr

    #1

    How to select a folder with native windows dialog box?

    I found the win32ui.CreateF ileDialog() function to select a file but
    nothing to select a folder :'-(
    Maybe someone has a solution for this?
    Thanks!

  • Roger Upole

    #2
    Re: How to select a folder with native windows dialog box?

    You can use SHBrowseForFold er:

    from win32com.shell import shell
    shell.SHBrowseF orFolder()

    Roger

    <flaus.a@wanado o.fr> wrote in message news:1150237380 .370088.29270@p 79g2000cwp.goog legroups.com...[color=blue]
    >I found the win32ui.CreateF ileDialog() function to select a file but
    > nothing to select a folder :'-(
    > Maybe someone has a solution for this?
    > Thanks!
    >[/color]



    ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

    Comment

    • flaus.a@wanadoo.fr

      #3
      Re: How to select a folder with native windows dialog box?

      Thanks for your answer, it's working fine!

      For information, the function to use to get the pathName is
      shell.SHGetPath FromIDList
      It returns an error if you select a special folder (!?!?) but otherwise
      it's working fine... And I was unable to fix this issue.

      Comment

      • Roger Upole

        #4
        Re: How to select a folder with native windows dialog box?

        <flaus.a@wanado o.fr> wrote in message news:1150317678 .028483.49080@i 40g2000cwc.goog legroups.com...[color=blue]
        > Thanks for your answer, it's working fine!
        >
        > For information, the function to use to get the pathName is
        > shell.SHGetPath FromIDList
        > It returns an error if you select a special folder (!?!?) but otherwise
        > it's working fine... And I was unable to fix this issue.[/color]

        SHGetPathFromID List only works for real filesystem folders.
        Pseudo-folders like Control Panel or Network Connections
        throw an error. You can use PyIShellFolder. BindToObject
        to get an interface to perform operations on these.

        Roger


        Comment

        Working...