Skip to main content

Problem:

This KB is an add-on to the demonstration GetDirectory.zip

available on MF Net Express samples page

http://supportline.microfocus.com/examplesandutilities/nesamp.asp#Win32API

"

"This program demonstrates the use of Win32 API calls SHBrowseForFolder and SHGetPathFromIDList to display a dialog box that will allow the user to select a directory.

"

____________________________________________________________

This amended demonstration allows to browse for FOLDERS and FILES

from the Desktop and from the Current Folder

____________________________________________________________

Resolution:

The add-ons are:

This amended demonstration allows to browse for FOLDERS and FILES

from the Desktop and from the Current Folder

===============

The content of the structure BROWSEINFO used by the MS API SHBrowseForFolder

MS API SHBrowseForFolder http://msdn2.microsoft.com/en-us/library/bb762115(VS.85).aspx

MS BROWSEINFO structure http://msdn2.microsoft.com/en-us/library/bb773205(VS.85).aspx

BROWSEINFO structure:

typedef struct _browseinfo {

    HWND hwndOwner;

    PCIDLIST_ABSOLUTE pidlRoot;

    LPTSTR pszDisplayName;

    LPCTSTR lpszTitle;

    UINT ulFlags;

    BFFCALLBACK lpfn;

    LPARAM lParam;

    int iImage;

} BROWSEINFO, *PBROWSEINFO, *LPBROWSEINFO;

1) Being able to Browse for Folders and Files

setting the ulFlags to BIF_BROWSEINCLUDEFILES will allow you to browse for Folders and files

( BIF_BROWSEINCLUDEFILES  )

( Version 4.71. The browse dialog box will display files as well as folders.)

2) Specifying the location of the root folder from which to start browsing

>>When the variable pidlRoot of the structure BROWSEINFO is equal to NULL,

              the namespace root (the desktop folder) is used.

>>When the variable pidlRoot of the structure BROWSEINFO is NOT equal to NULL,

This PIDL (pointer to an item identifier list) specifies the location of the root folder from which to start browsing.

See , in demo attached, that the PIDL is set to the current working directory having used the MF CBL_GET_CURRENT_DIR the MS API ILCreateFromPathW

MS API ILCreateFromPathW: http://msdn2.microsoft.com/en-us/library/bb776438(VS.85).aspx

===============

Old KB# 1580