Browse for a folder using the standard Win dialogTag(s): Powerscript
[External FUNCTION declaration]
FUNCTION long SHGetPathFromIDListA (long pidl, ref string pszPath) &
LIBRARY "shell32.dll"
FUNCTION long SHBrowseForFolderA ( BROWSEINFO lpBrowseInfo) &
LIBRARY "shell32.dll"
[structure BROWSEINFO]
howner long
pidlroot long
pszdisplayname string
lpsztitle string
ulflags long
lpfn long
lparam long
iimage long
[Powerscript]
browseinfo lst_bi
long ll_pidl
int li_thispos
string ls_path, ls_xs
long ll_rc
ls_path=space(512) // maximum path lenght
lst_bi.howner=handle(this) // handle of the window
lst_bi.pidlRoot = 0
lst_bi.pszdisplayname = space(260)
lst_bi.lpszTitle = "Select a folder"
lst_bi.ulFlags = 1
ll_pidl = SHBrowseForFolderA(lst_bi)
ll_rc = SHGetPathFromIDListA(ll_pidl, ls_path)
IF NOT ll_rc > 0 THEN
SetNull(ls_path)
END IF
MessageBox("Folder selected" , ls_path)
[external function declaration] SUBROUTINE CoTaskMemFree( long lpv ) LIBRARY "ole32.dll" [powerscript] SHBrowseForFolder( lst_bi ) CoTaskMemFree( lst_bi.pidlRoot )
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com