本帖最后由 bdancerlc 于 2011-12-18 23:26 编辑
我想实现的功能是拖拽的文件内容赋值到edit里面,可是通过@GUI_DragFile总是读不到文件内容:
先上代码
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("测试事件模式", 468, 136, 192, 124, $GUI_DROPACCEPTED, $WS_EX_ACCEPTFILES)
$edit = GUICtrlCreateEdit("",0,0,468,136)
GUICtrlSetState($edit,$GUI_DROPACCEPTED)
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
GUISetOnEvent($GUI_EVENT_DROPPED, "gui")
Opt("GUIOnEventMode", 1)
GUISetState(@SW_SHOW)
Global $start = 0,$i
While 1
Sleep(100)
WEnd
Func gui()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_DROPPED
$file=FileRead (@GUI_DragFile)
MsgBox(0,'',$file)
EndSwitch
EndFunc ;==>gui
求解,不知道是哪里有问题... |