CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2003
    Location
    south africa
    Posts
    64

    directory browse

    does anyone know of an API call to bring up a directory browse box.

  2. #2
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

  3. #3
    Join Date
    May 2000
    Location
    Toronto, ON, Canada
    Posts
    3,573
    Hi,

    Code:
    BOOL GetOpenFileName(
      LPOPENFILENAME lpofn   // initialization data
    );
    Look in MSDN for details.
    Regards,

    Emanuel Vaduva

  4. #4
    Join Date
    Sep 2002
    Posts
    924
    You could use SHBrowseForFolder

  5. #5
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Code:
    char         szExtBuffer[MAX_PATH] = "";
    OPENFILENAME ofn;
    
    strcpy(szExtBuffer, "*.txt; *.log");
    
    ofn.lStructSize       = sizeof(ofn);
    ofn.hwndOwner         = 0;
    ofn.hInstance         = 0;
    ofn.lpstrFilter       = 0;
    ofn.lpstrCustomFilter = 0;
    ofn.nMaxCustFilter    = 0;
    ofn.nFilterIndex      = 0;
    ofn.lpstrFile         = szExtBuffer;
    ofn.nMaxFile          = MAX_PATH;
    ofn.lpstrFileTitle    = 0;
    ofn.nMaxFileTitle     = 0;
    ofn.lpstrInitialDir   = 0;
    ofn.lpstrTitle        = "Open file";
    ofn.Flags             = 0;
    ofn.nFileOffset       = 0;
    ofn.nFileExtension    = 0;
    ofn.lpstrDefExt       = 0;
    ofn.lCustData         = 0;
    ofn.lpfnHook          = 0;
    ofn.lpTemplateName    = 0;
    
    // Open dialog
    if(::GetOpenFileName(&ofn) == FALSE)
      // Cancel pressed

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

Featured