找回密码
 加入
搜索
查看: 4588|回复: 8

[IE类操作] GUI内嵌IE如何使用 按钮 实现上下翻滚功能

  [复制链接]
发表于 2011-3-31 09:14:57 | 显示全部楼层 |阅读模式
本帖最后由 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
 楼主| 发表于 2011-3-31 14:29:32 | 显示全部楼层
_IEAction 不能指定上下翻页啊。
发表于 2011-3-31 18:49:50 | 显示全部楼层
$oIE.document.body.scrollTop = $oIE.document.body.scrollTop + xxx            下翻
$oIE.document.body.scrollTop = $oIE.document.body.scrollTop - xxx             上翻
xxx 为数字 是滚动的幅度
是这样吗?
 楼主| 发表于 2011-4-1 11:30:20 | 显示全部楼层
$oIE.document.body.scrollTop = $oIE.document.body.scrollTop + xxx            下翻
$oIE.document.bod ...
xxoojoeooxx 发表于 2011-3-31 18:49



    请问下这个如何应用到我的代码里呢?
以下是我的全部代码
#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
发表于 2011-4-1 20:03:27 | 显示全部楼层

_IEAction ($oIE, "down")
改成
$oIE.document.body.scrollTop = $oIE.document.body.scrollTop + xxx <xxx自己测试大概是多少

另外一个一样
 楼主| 发表于 2011-4-2 15:10:06 | 显示全部楼层

_IEAction ($oIE, "down")
改成
$oIE.document.body.scrollTop = $oIE.document.body.scrollTop + xx ...
xxoojoeooxx 发表于 2011-4-1 20:03


这样不行啊,我开始也是这样改的,都没反应啊。
发表于 2011-4-2 21:07:21 | 显示全部楼层
用 _IEImgClick  不知是否可行?
 楼主| 发表于 2011-4-6 08:43:58 | 显示全部楼层
用 _IEImgClick  不知是否可行?
zitoy 发表于 2011-4-2 21:07



    请问zitoy老兄,_IEImgClick 如何实现我的问题?
 楼主| 发表于 2011-4-7 08:57:10 | 显示全部楼层
顶起来,等待解决中。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-21 11:09 , Processed in 0.097364 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表