可以同步捕获onDragStart事件,写了个代码,关于如何响应拖拽事件还得楼主自行解决(示例中直接定时器代替),CF_HTML剪切板数据格式化也没搞太明白,还是得楼主自行解决, 哈哈#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#Include <Clipboard.au3>
#include <IE.au3>
Global $oIE = _IECreate("www.baidu.com")
$Form1 = GUICreate("", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES)
$Edit1 = GUICtrlCreateEdit("", 0, 0, 300, 200)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUISetState(@SW_SHOW)
WinSetOnTop($Form1, "", 1)
Local $sJS_GetText = "var oRange = document.selection.createRange(); var sText = oRange.text; window.clipboardData.setData('text', sText); "
_IEHeadInsertEventScript($oIE, "document", "ondragstart", $sJS_GetText)
Local $iFormat = $CF_UNICODETEXT
;Local $sJS_GetHtml = "var oRange = document.selection.createRange(); var sText = oRange.htmltext; window.clipboardData.setData('text', sText); "
;_IEHeadInsertEventScript($oIE, "document", "ondragstart", $sJS_GetHtml)
;Local $iFormat = _ClipBoard_RegisterFormat("HTML Format");CF_HTML
AdlibRegister("_setText", 500)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_IEQuit($oIE)
Exit
EndSwitch
WEnd
Func _setText()
_ClipBoard_Open(0)
GUICtrlSetData($Edit1, _ClipBoard_GetData($iFormat))
_ClipBoard_Close()
EndFunc
|