Announcement

Collapse
No announcement yet.

shBrowseForFolder - validating selection?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • shBrowseForFolder - validating selection?

    Folks,

    I'm trying to validate local folders with shBrowseForFolder() and BrowseCallbackProc() so I can disable the OK button for non-local drives/folders.

    While I can reject most network connections by testing the path, thus:
    Code:
    CALLBACK FUNCTION BrowseForFolderProc
        IF CBMSG = %BFFM_INITIALIZED THEN
            DIALOG SEND CBHNDL, %BFFM_SETSELECTION, %TRUE, CBLPARAM
        ELSEIF CBMSG = %BFFM_SELCHANGED THEN
            DIM zBuffer AS ASCIIZ * %MAX_PATH
            CALL SHGetPathFromIDList(BYVAL CBWPARAM, zBuffer)
            IF ISFALSE CBWPARAM OR ISFALSE LEN(zBuffer) OR _
                ISFALSE (GETATTR(zBuffer) AND %SUBDIR) OR _
                MID$(zBuffer,2,1) <> ":" THEN
                DIALOG SEND CBHNDL, %BFFM_ENABLEOK, %FALSE, %FALSE
                BEEP ' test only - not for final version
            END IF
        END IF
    END FUNCTION
    However, if I have shortcuts to network drives in my "Network Neighborhood" section (Win2K), the root names are detected as folders on the local PC, so the OK button is left enabled.

    Does anyone have any ideas how to reliably detect the selection of one of these shortcut names?

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

  • #2
    Does this help?

    Code:
    BIF_DONTGOBELOWDOMAIN
    Does not include network folders below the domain level in the 
    tree view control.
    
    BIF_RETURNONLYFSDIRS
    Only returns file system directories. If the user selects 
    foldersthat are not part of the file system, the OK button is grayed.

    ------------------
    E-Mail (home): mailto:[email protected][email protected]</A>
    E-Mail (work): mailto:[email protected][email protected]</A>

    [This message has been edited by Sven Blumenstein (edited July 04, 2001).]

    Comment


    • #3
      Lance --
      take a look http://support.microsoft.com/support.../Q192/6/89.ASP


      ------------------
      E-MAIL: [email protected]

      Comment


      • #4
        Lance,

        I don't know anything about Windows shortcuts, but if the
        shortcuts contain the drive letters for the programs/folders,
        then you could try using:

        L1 = GetDriveType(A$)

        A$ = ASCIIZ containing root path of drive in question

        L1 = UINT

        If the drive letter queried is a Network drive,
        L1 will return %DRIVE_REMOTE

        Hope that helps!


        ------------------
        Clay C. Clear

        http://www.v3space.com/a/a39/202/

        [email protected]
        [email protected]

        Comment


        • #5
          Thanks for the ideas folks, but the problem is not quite straight forward...

          Yes, I'm using %BIF_DONTGOBELOWDOMAIN and also %BIF_RETURNONLYFSDIRS (and I've experimented with %BIF_RETURNFSANCESTORS). The code above excludes any folder name whose 2nd letter is not a colon (truely Mapped drives will be ok), but the key problem is shortcuts contained in "My Network Places" cannot be discriminated from (what I call) "real" folders.

          For example, "Computers Near Me" is returned from ShBrowseForFOlder as "C:\Documents and Settings\Administrator\NetHood\Computers Near Me".

          Any ideas how to exclude a name that appears as a child of "My Network Places" in the list.

          Thanks!

          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            Have you checked what attributes are set for it? Some folders, like
            Recycled have Directory+Hidden+System set, others may have other
            combinations. Maybe this one has some other unique combination one
            can use? Just a wild idea..


            ------------------

            Comment


            • #7
              Lance --
              You talk that you are interesting in local folders.
              If so, how can "Computers near me" appear ?

              Do you restrict selection by BROWSEINFO.pidlRoot = "My Computer" ?



              ------------------
              E-MAIL: [email protected]

              Comment

              Working...
              X