📄 browse_for_folder.hpp
字号:
browseinfo.pidlRoot = pidlRoot;
browseinfo.pszDisplayName = displayName;
browseinfo.lpszTitle = title;
browseinfo.ulFlags = flags;
if( NULL != defaultFolder &&
'\0' != *defaultFolder)
{
browseinfo.lpfn = &shell_browse_callback_holder<C>::proc;
browseinfo.lParam = reinterpret_cast<LPARAM>(defaultFolder);
}
else
{
browseinfo.lpfn = 0;
browseinfo.lParam = 0;
}
lpiidl = traits_type::browseforfolder(&browseinfo);
if(lpiidl != 0)
{
if(traits_type::getpathfromidlist(lpiidl, displayName))
{
bRet = true;
}
shell_allocator<ITEMIDLIST>().deallocate(lpiidl);
}
if(!bRet)
{
displayName[0] = '\0';
}
return bRet;
}
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
// function browse_for_folder
/** \brief Browses the shell namespace according to the given parameters
*
* \ingroup group__library__windows_shell
*
* \param title The title for the browse dialog
* \param displayName Buffer to receive the display name
* \param flags Combination of the <b>BIF_*</b> flags for the Win32 \c SHBrowseForFolder() function
* \param hwndOwner The parent of the browse dialog. May be null
* \param pidlRoot Pointer to an ITEMIDLIST structure (PIDL) specifying the location of the root folder from which to start browsing. May be null
*/
template< ss_typename_param_k S
, ss_typename_param_k C
>
inline ws_bool_t browse_for_folder(S const& title, C* displayName, UINT flags, HWND hwndOwner, LPCITEMIDLIST pidlRoot)
{
return shell_browse_impl(stlsoft_ns_qual(c_str_ptr)(title), displayName, flags, hwndOwner, pidlRoot, static_cast<C const*>(NULL));
}
/** \brief Browses the shell namespace according to the given parameters
*
* \ingroup group__library__windows_shell
*
* \param title The title for the browse dialog
* \param displayName Buffer to receive the display name
* \param flags Combination of the <b>BIF_*</b> flags for the Win32 \c SHBrowseForFolder() function
* \param hwndOwner The parent of the browse dialog. May be null
* \param pidlRoot Pointer to an ITEMIDLIST structure (PIDL) specifying the location of the root folder from which to start browsing. May be null
* \param defaultFolder The default folder to select when the browse window opens
*/
template< ss_typename_param_k S0
, ss_typename_param_k C
, ss_typename_param_k S1
>
inline ws_bool_t browse_for_folder(S0 const& title, C* displayName, UINT flags, HWND hwndOwner, LPCITEMIDLIST pidlRoot, S1 const& defaultFolder)
{
return shell_browse_impl(stlsoft_ns_qual(c_str_ptr)(title), displayName, flags, hwndOwner, pidlRoot, stlsoft_ns_qual(c_str_ptr)(defaultFolder));
}
/** \brief Browses the shell namespace according to the given parameters
*
* \ingroup group__library__windows_shell
*
* \param title The title for the browse dialog
* \param displayName Buffer to receive the display name
* \param flags Combination of the <b>BIF_*</b> flags for the Win32 \c SHBrowseForFolder() function
* \param hwndOwner The parent of the browse dialog. May be null
*/
template< ss_typename_param_k S
, ss_typename_param_k C
>
inline ws_bool_t browse_for_folder(S const& title, C* displayName, UINT flags, HWND hwndOwner)
{
return browse_for_folder(title, displayName, flags, hwndOwner, static_cast<LPCITEMIDLIST>(0));
}
/** \brief Browses the shell namespace according to the given parameters
*
* \ingroup group__library__windows_shell
*
* \param title The title for the browse dialog
* \param displayName Buffer to receive the display name
* \param flags Combination of the <b>BIF_*</b> flags for the Win32 \c SHBrowseForFolder() function
* \param pidlRoot Pointer to an ITEMIDLIST structure (PIDL) specifying the location of the root folder from which to start browsing. May be null
*/
template< ss_typename_param_k S
, ss_typename_param_k C
>
inline ws_bool_t browse_for_folder(S const& title, C* displayName, UINT flags, LPCITEMIDLIST pidlRoot)
{
return browse_for_folder(title, displayName, flags, 0, pidlRoot);
}
/** \brief Browses the shell namespace according to the given parameters
*
* \ingroup group__library__windows_shell
*
* \param title The title for the browse dialog
* \param displayName Buffer to receive the display name
* \param flags Combination of the <b>BIF_*</b> flags for the Win32 \c SHBrowseForFolder() function
*/
template< ss_typename_param_k S
, ss_typename_param_k C
>
inline ws_bool_t browse_for_folder(S const& title, C* displayName, UINT flags)
{
return browse_for_folder(title, displayName, flags, 0, 0);
}
#if !defined(STLSOFT_COMPILER_IS_DMC) && \
!defined(STLSOFT_COMPILER_IS_MWERKS) && \
( !defined(STLSOFT_COMPILER_IS_MSVC) || \
_MSC_VER != 1300)
/** \brief Browses the shell namespace according to the given parameters
*
* \ingroup group__library__windows_shell
*
* \param title The title for the browse dialog
* \param displayName Buffer to receive the display name
* \param flags Combination of the <b>BIF_*</b> flags for the Win32 \c SHBrowseForFolder() function
* \param defaultFolder The default folder to select when the browse window opens
*/
template< ss_typename_param_k S0
, ss_typename_param_k C
, ss_typename_param_k S1
>
inline ws_bool_t browse_for_folder( S0 const &title
, C *displayName
, UINT flags
, S1 const &defaultFolder
)
{
return browse_for_folder(title, displayName, flags, 0, 0, defaultFolder);
}
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
// Disambiguates between the two four parameter overloads
// browse_for_folder(S const& , C *, UINT , LPCITEMIDLIST )
// and
// template < . . . >
// browse_for_folder(S0 const&, C*, UINT, S1 const&)
template< ss_typename_param_k S
, ss_typename_param_k C
>
inline ws_bool_t browse_for_folder(S const& title, C* displayName, UINT flags, LPITEMIDLIST pidlRoot)
{
return browse_for_folder(title, displayName, flags, const_cast<LPCITEMIDLIST>(pidlRoot));
}
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
#endif /* compiler */
/** \brief Browses the shell namespace according to the given parameters
*
* \ingroup group__library__windows_shell
*
* \param title The title for the browse dialog
* \param displayName Buffer to receive the display name
*/
template< ss_typename_param_k S
, ss_typename_param_k C
>
inline ws_bool_t browse_for_folder(S const& title, C* displayName)
{
return browse_for_folder(title, displayName, 0, 0, 0);
}
////////////////////////////////////////////////////////////////////////////
// Unit-testing
#ifdef STLSOFT_UNITTEST
# include "./unittest/browse_for_folder_unittest_.h"
#endif /* STLSOFT_UNITTEST */
/* ////////////////////////////////////////////////////////////////////// */
#ifndef _WINSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
} // namespace winstl
# else
} // namespace winstl_project
} // namespace stlsoft
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_WINSTL_NO_NAMESPACE */
/* ////////////////////////////////////////////////////////////////////// */
#endif /* WINSTL_INCL_WINSTL_SHELL_HPP_BROWSE_FOR_FOLDER */
/* ////////////////////////////////////////////////////////////////////// */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -