求教各位大侠,截图中的显示方式如何实现
本帖最后由 franky 于 2009-12-15 10:15 编辑就和图片里面的一样,选择一个盘符之后,能在下面把对应的文件夹都列举出来,再选择其中的一个文件夹,能把它下面的子文件夹列举出来,个人感觉和资源管理器类似的东西? 官方找的,位置和你的相反。Global $sSelected = _FileOpenDialogWithPreview("Open with preview", "", "All files (*.*)", "")
ConsoleWrite("!@error = " & @error & @CRLF)
ConsoleWrite("Selected: " & $sSelected & @CRLF)
Func _FileOpenDialogWithPreview($sTitle = "Open", $sInitDir = "", $sFilter = "All Files (*.*)", $sDefaultName = "", $hWnd = 0)
; OPENFILENAME structure:
Local $tOPENFILENAME = DllStructCreate("dword StructSize;" & _
"hwnd Owner;" & _
"ptr Instance;" & _
"ptr Filter;" & _
"ptrCustomFilter;" & _
"dword MaxCustFilter;" & _
"dword FilterIndex;" & _
"ptr File;" & _
"dword MaxFile;" & _
"ptr FileTitle;" & _
"dword MaxFileTitle;" & _
"ptr InitialDir;" & _
"ptr Title;" & _
"dword Flags;" & _
"ushort FileOffset;" & _
"ushort FileExtension;" & _
"ptr DefExt;" & _
"ptr CustData;" & _
"ptr Hook;" & _
"ptr TemplateName;" & _
"ptr Reserved;" & _
"dword SizeReserved;" & _
"dword FlagsEx")
; Set size and owner:
DllStructSetData($tOPENFILENAME, "StructSize", DllStructGetSize($tOPENFILENAME))
DllStructSetData($tOPENFILENAME, "Owner", $hWnd)
; Filter job:
Local $tagFilter
Local $aArray = StringRegExp($sFilter & "|", "\s*(.*?)\s*\((.*?)\)\|", 3)
For $i = 0 To UBound($aArray) - 1
$tagFilter &= "wchar[" & StringLen($aArray[$i]) + 1 & "];"
Next
$tagFilter &= "wchar"
Local $tFilter = DllStructCreate($tagFilter)
For $i = 0 To UBound($aArray) - 1
DllStructSetData($tFilter, $i + 1, $aArray[$i])
Next
DllStructSetData($tOPENFILENAME, "Filter", DllStructGetPtr($tFilter, 1))
; Path job:
Local $tPath = DllStructCreate("wchar")
DllStructSetData($tPath, 1, $sDefaultName)
DllStructSetData($tOPENFILENAME, "File", DllStructGetPtr($tPath))
DllStructSetData($tOPENFILENAME, "MaxFile", 32767)
; Title job:
Local $tTitle = DllStructCreate("wchar[" & StringLen($sTitle) + 1 & "]")
DllStructSetData($tTitle, 1, $sTitle)
DllStructSetData($tOPENFILENAME, "Title", DllStructGetPtr($tTitle))
; Initial dir job:
Local $tInitDir = DllStructCreate("wchar[" & StringLen($sInitDir) + 1 & "]")
DllStructSetData($tInitDir, 1, $sInitDir)
DllStructSetData($tOPENFILENAME, "InitialDir", DllStructGetPtr($tInitDir))
; Call the function
DllCall("msvfw32.dll", "int", "GetOpenFileNamePreviewW", "ptr", DllStructGetPtr($tOPENFILENAME))
; Get wanted string
Local $sOut = DllStructGetData(DllStructCreate("wchar", DllStructGetData($tOPENFILENAME, "File")), 1)
Return SetError($sOut = False, 0, $sOut)
EndFunc ;==>_FileOpenDialogWithPreview
哇塞,感谢版主,是从官方论坛上找到的么?看来官方论坛还是很强大的,以后我在提问之前也去那边啃啃!十分感谢~ 呃。看了代码。。看不懂呢。。晕倒了 :face (31):拷贝么 呵呵,现在能做到的只能是拷贝了,基础差的太多了。。 好深奥啊!看不懂!!! 看不懂呢。。。。学习中。。
页:
[1]