Results 1 to 4 of 4

Thread: vb 2002 net and an "open folder" dialog RESOLVED

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2004
    Posts
    27

    vb 2002 net and an "open folder" dialog RESOLVED

    hi,

    i'm trying for hours now to find out how to get a simple "choose older" dialog for vb 2002 net. i only found example for the classic vb. can someone tell me how to convert this code here to vb net ?


    Code:
    option Explicit
    
    'Constantes
    private Const BIF_RETURNONLYFSDIRS = &H1        'Uniquement des répertoire
    private Const BIF_DONTGOBELOWDOMAIN = &H2       'Domaine globale intredit
    private Const BIF_STATUSTEXT = &H4              'Zone de saisie autorisée
    private Const BIF_RETURNFSANCESTORS = &H8
    private Const BIF_EDITBOX = &H10                'Zone de saisie autorisée
    private Const BIF_VALIDATE = &H20               'insist on valid result (or CANCEL)
    private Const BIF_BROWSEFORCOMPUTER = &H1000    'Uniquement des PCs.
    private Const BIF_BROWSEFORPRINTER = &H2000     'Uniquement des imprimantes
    private Const BIF_BROWSEINCLUDEFILES = &H4000   'Browsing for Everything
    
    private Const MAX_PATH = 260
    
    'Types
    private Type T_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
    
    'Fonctions API Windows
    private Declare Function SHBrowseForFolder Lib "shell32" _
                                      (lpbi as T_BROWSEINFO) as Long
    
    private Declare Function SHGetPathFromIDList Lib "shell32" _
                                      (byval pidList as Long, _
                                      byval lpBuffer as string) as Long
    
    private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" _
                                      (byval lpString1 as string, byval _
                                      lpString2 as string) as Long
    
    '****************************************************************************************************
    '*  BrowseFolder :
    '*  Entrées :   - HwndOwner     : Handle de la fenêtre appelante
    '*              - Titre         : Titre
    '*  Sorties :
    '*              - string contenant le chemin complet ou Chaine vide (si annulation)
    '*
    '*  Affiche une boite de dialogue permettant la sélection d'un répertoire.
    '*  Renvoie une chaine vide si l'opérateur annule.
    '****************************************************************************************************
    public Function BrowseFolder(byval HwndOwner as Long, byref Titre as string) as string
    
        Dim lpIDList as Long
        Dim sBuffer as string
        Dim BrowseInfo as T_BROWSEINFO
    
        'Initialise l'affichage
        BrowseFolder = ""
        With BrowseInfo
            .HwndOwner = HwndOwner
            .lpszTitle = lstrcat(Titre, "")
            .ulFlags = BIF_RETURNONLYFSDIRS
        End With
    
        'Affiche la boite de dialogue
        lpIDList = SHBrowseForFolder(BrowseInfo)
        
        'Récupère le répertoire sélectionné
        If (lpIDList) then
            sBuffer = Space(MAX_PATH)
            SHGetPathFromIDList lpIDList, sBuffer
            sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
            BrowseFolder = sBuffer
        End If
    End Function
    or does someone have a class or function that i can use? i am only trying to make a simple programm.

    thanx,

    usul
    Last edited by Usul; Aug 4th, 2004 at 08:44 AM.

  2. #2
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    Check this sample from MS. It's made specifically for VB.NET

    http://support.microsoft.com/default...b;en-us;811004
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2004
    Posts
    27
    thank you A LOT ! ! !

    didnt find this link on google. works great. did I say thanx?

  4. #4
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Your Welcome
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width