GUI内嵌IE如何使用 按钮 实现上下翻滚功能
本帖最后由 cd309420 于 2011-4-1 14:10 编辑如题:我在GUI窗体上设置了网页上翻下翻的按钮,想请问下如何实现其功能?麻烦大大给段代码。其它按钮均可用。While 1
If $oIE.readyState <> 4 Then _self()
$msg = GUIGetMsg()
Select
Case $msg = $GUI_Button_Stop
_IEAction($oIE, "stop")
Case $msg = $GUI_Button_Refresh
_IEAction($oIE, "Refresh")
Case $msg = $GUI_Button_Home
_IENavigate($oIE, $web)
Case $msg = $GUI_Button_Back
_IEAction($oIE, "back")
Case $msg = $GUI_Button_Forward
_IEAction($oIE, "forward")
Case $msg = ($GUI_Button_Up);上翻 占位
_IEAction ($oIE, "up")
Case $msg = ($GUI_Button_Down);下翻 占位
_IEAction ($oIE, "down")
Case $msg = $GUI_Button_Close
ExitLoop
EndSelect
WEnd
Exit _IEAction 不能指定上下翻页啊。 $oIE.document.body.scrollTop = $oIE.document.body.scrollTop + xxx 下翻
$oIE.document.body.scrollTop = $oIE.document.body.scrollTop - xxx 上翻
xxx 为数字 是滚动的幅度
是这样吗? $oIE.document.body.scrollTop = $oIE.document.body.scrollTop + xxx 下翻
$oIE.document.bod ...
xxoojoeooxx 发表于 2011-3-31 18:49 http://www.autoitx.com/images/common/back.gif
请问下这个如何应用到我的代码里呢?
以下是我的全部代码#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=D:\ico\tab_danger.ico
#AutoIt3Wrapper_outfile=fullIE.exe
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
Opt("TrayIconHide",1)
_IEErrorHandlerRegister ()
GUICreate("全屏浏览器", 3030, 750, (@DesktopWidth - 1033) / 2, (@DesktopHeight - 750) / 2, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW)
$oIE = _IECreateEmbedded()
$web = "http://www.baidu.com/"
$GUIActiveX = GUICtrlCreateObj($oIE, -2, -2, 1030, 735)
$GUI_Button_Stop = GUICtrlCreateButton("停 止", 20, 718, 80, 30)
$GUI_Button_Refresh = GUICtrlCreateButton("刷 新", 290, 718, 80, 30)
$GUI_Button_Home = GUICtrlCreateButton("主 页", 560, 718, 80, 30)
$GUI_Button_Back = GUICtrlCreateButton("后 退", 1100, 718, 80, 30)
$GUI_Button_Forward = GUICtrlCreateButton("前 进", 1520, 718, 80, 30)
$GUI_Button_Up = GUICtrlCreateButton("上 翻", 1790, 718, 80, 30)
$GUI_Button_Down = GUICtrlCreateButton("下 翻", 2060, 718, 80, 30)
$GUI_Button_Close = GUICtrlCreateButton("退 出", 2920, 718, 80, 30)
GUISetState();(@SW_SHOW)
GUISetState(@SW_MAXIMIZE)
$oIE.navigate("about:blank")
$oIE.document.body.style.border = "0"
$oIE.document.write("<body style='border:0;margin:0px'><iframe scrolling=no frameborder=0 src =" & $web & " width=100% height=100%></iframe></body>")
$oIE.refresh
$oIE.document.body.scroll = "no"
$colLinks = _IELinkGetCollection($oIE)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_Button_Stop
_IEAction ($oIE, "stop")
Case $msg = $GUI_Button_Refresh
_IEAction ($oIE, "Refresh")
Case $msg = $GUI_Button_Home
_IENavigate ($oIE, $web)
Case $msg = $GUI_Button_Back
_IEAction ($oIE, "back")
Case $msg = $GUI_Button_Forward
_IEAction ($oIE, "forward")
; Case $msg = ($GUI_Button_Up);上翻 占位
; _IEAction ($oIE, "up")
; Case $msg = ($GUI_Button_Down);下翻 占位
; _IEAction ($oIE, "down")
Case $msg = $GUI_Button_Close
ExitLoop
EndSelect
WEnd
Exit 把
_IEAction ($oIE, "down")
改成
$oIE.document.body.scrollTop = $oIE.document.body.scrollTop + xxx <xxx自己测试大概是多少
另外一个一样 把
_IEAction ($oIE, "down")
改成
$oIE.document.body.scrollTop = $oIE.document.body.scrollTop + xx ...
xxoojoeooxx 发表于 2011-4-1 20:03 http://www.autoitx.com/images/common/back.gif
这样不行啊,我开始也是这样改的,都没反应啊。 用 _IEImgClick不知是否可行? 用 _IEImgClick不知是否可行?
zitoy 发表于 2011-4-2 21:07 http://www.autoitx.com/images/common/back.gif
请问zitoy老兄,_IEImgClick 如何实现我的问题? 顶起来,等待解决中。
页:
[1]