本帖最后由 yhxhappy 于 2011-3-12 23:43 编辑
LZ的意思是不是想用新拖动的文件名替换旧的,而不是连起来啊?如果是这样用事件模式要好些
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Local $file, $btn, $msg
GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI")
GUISetOnEvent($GUI_EVENT_DROPPED, "_GUI")
$file = GUICtrlCreateInput("", 10, 5, 300, 20)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlCreateInput("", 10, 35, 300, 20) ; will not accept drag&drop files
$btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)
GUICtrlSetOnEvent(-1, "_GUI")
GUISetState()
While 1
Sleep(10)
WEnd
Func _GUI()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE, $btn
MsgBox(4096, "drag drop file", GUICtrlRead($file))
Exit
Case $GUI_EVENT_DROPPED
GUICtrlSetData($file, @GUI_DRAGFILE)
EndSwitch
EndFunc
|