找回密码
 加入
搜索
查看: 2204|回复: 4

开一个不能关闭的ie窗口

[复制链接]
发表于 2008-12-28 20:53:08 | 显示全部楼层 |阅读模式
记得以前坛子里有这样的例程,但是刚才搜索了一下才发现不见了。

要求ie不能被关闭,或者能拦截关闭IE的消息也行,autoit的实现方案是怎样的啊?
发表于 2008-12-28 22:39:49 | 显示全部楼层
不能关闭?那你用AU3创建一个无标题窗口内置IE吧。这样还简单。

拦截的应该也可以。只是复杂了。
 楼主| 发表于 2008-12-29 07:10:56 | 显示全部楼层
内建窗口要过防火墙啊。。

我仅仅需要一个简单控制IE的小东西。以前看见过,关闭窗口时有提示,确认或取消的。
发表于 2008-12-31 22:17:00 | 显示全部楼层
原帖由 sanhen 于 2008-12-28 22:39 发表
不能关闭?那你用AU3创建一个无标题窗口内置IE吧。这样还简单。

拦截的应该也可以。只是复杂了。

请问sanhen如何内置IE?能举个例子吗/
发表于 2009-1-1 11:18:24 | 显示全部楼层
修改的例程,不响应close消息就不能关闭了
[au3]; *******************************************************
; Example 1 - Trap COM errors so that 'Back' and 'Forward'
;                                outside of history bounds does not abort script
;                                (expect COM errors to be sent to the console)
; *******************************************************
;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
GUICreate("Embedded Web control Test", 640, 580, _
                (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
                $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState()       ;Show GUI

_IENavigate ($oIE, "http://www.autoitscript.com")

; Waiting for user to close the window
While 1
        $msg = GUIGetMsg()
        Select
                Case $msg = $GUI_EVENT_CLOSE
                        ;ExitLoop 这个是例程,不响应这个消息,窗口就不能关闭了。
                Case $msg = $GUI_Button_Home
                        _IENavigate ($oIE, "http://www.autoitscript.com")
                Case $msg = $GUI_Button_Back
                        _IEAction ($oIE, "back")
                Case $msg = $GUI_Button_Forward
                        _IEAction ($oIE, "forward")
                Case $msg = $GUI_Button_Stop
                        _IEAction ($oIE, "stop")
        EndSelect
WEnd

GUIDelete()

Exit[/au3]
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-23 09:24 , Processed in 0.075554 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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