option explicit
private const bif_returnonlyfsdirs = 1
private const bif_dontgobelowdomain = 2
private const max_path = 260
private declare function shbrowseforfolder lib "shell32" _
(lpbi as 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
private type 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
private sub command1_click()
dim lpidlist as long
dim sbuffer as string
dim sztitle as string
dim tbrowseinfo as browseinfo
sztitle = "this is the title"
with tbrowseinfo
.hwndowner = me.hwnd
.lpsztitle = lstrcat(sztitle, "")
.ulflags = bif_returnonlyfsdirs + bif_dontgobelowdomain
end with
lpidlist = shbrowseforfolder(tbrowseinfo)
if (lpidlist) then
sbuffer = space(max_path)
shgetpathfromidlist lpidlist, sbuffer
sbuffer = left(sbuffer, instr(sbuffer, vbnullchar) - 1)
msgbox sbuffer
end if
end sub
delphi之選擇資料夾路徑 選擇檔案路徑
一 opendialog選擇檔案路徑 procedure tform4.but2click sender tobject varchobak topendialog begin chobak topendialog.create nil if chobak.execute then begin sh...
Unity 彈窗選擇路徑,選擇檔案
在unity中使用彈窗選擇路徑 1,將system.windows.forms.dll放到assets plugins資料夾下 2,中using system.windows.forms 3,使用 1 選擇資料夾 string defaultpath directoryinfo mydir new ...
儲存檔案路徑的選擇
1.browseinfo visual c vc 中,browseinfo 結構中包含有使用者選中目錄的重要資訊。1 browseinfo結構 定義typedef struct browseinfo browseinfo,pbrowseinfo,lpbrowseinfo 成員變數 hwndowner...