简单栽培 发表于 2012-6-22 20:19:31

第一次写脚本,程序不能连续运行,请高人指点(已解决)

本帖最后由 简单栽培 于 2012-6-22 21:37 编辑

程序为什么运行一次或几次之后就无法运行了,必须退出之后才能运行。另我想小程序一直浮于窗口的最前,不被其他打开的程序覆盖。程序中不知缺少什么代码,请高手指点一下,万分感谢!代码如下:
#include <IE.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("测试", 450, 60, 520, 1 )
$Button1 = GUICtrlCreateButton("123开始", 10, 10, 100, 40, 0)
$Button2 = GUICtrlCreateButton("新浪", 120, 10, 100, 40, 0)
$Button3 = GUICtrlCreateButton("汽车", 230, 10, 100, 40, 0)
$Button4 = GUICtrlCreateButton("好网", 340, 10, 100, 40, 0)
GUISetState(@SW_SHOW)

FUNC _my_ffs ()
        $oIE = _IECreate("http://www.hao123.com/", 1, 1, 1, 1)
       
ENDFUNC        

While 1
        $nMsg = GUIGetMsg()
        Select
                Case$nMsg = $Button1   
                        WinActivate (_my_ffs ())
                                               
                Case$nMsg = $Button2
                        $oIE = _IECreate("http://www.sina.com.cn/", 1, 1, 1, 1)
                       
      Case$nMsg = $Button3                       
                        $oIE = _IECreate("http://www.autohome.com.cn/", 1, 1, 1, 1)
               
                Case$nMsg = $Button4       
                        WinActivate (_my_ffs ())
                       
EndSelect
WEnd

ooxxgod 发表于 2012-6-22 20:43:32

我的3.3.9.5IE出问题

zerobin 发表于 2012-6-22 20:59:24

楼主看看这个   点击这里和点击这里2

happytc 发表于 2012-6-22 21:11:26

回复 1# 简单栽培


    新手嘛,还是回复下

#include <IE.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>

Global Const $SC_MOVE = 0xF010

$Form1 = GUICreate("测试", 450, 60, 520, 1, BitOR($WS_SYSMENU, $WS_POPUP))
$Button1 = GUICtrlCreateButton("123开始", 10, 10, 100, 40, 0)
$Button2 = GUICtrlCreateButton("新浪", 120, 10, 100, 40, 0)
$Button3 = GUICtrlCreateButton("汽车", 230, 10, 100, 40, 0)
$Button4 = GUICtrlCreateButton("好网", 340, 10, 100, 40, 0)
GUISetState(@SW_SHOW)

Func _my_ffs()
        $oIE = _IECreate("http://www.hao123.com/", 1, 1, 0)

EndFunc   ;==>_my_ffs

While 1
        $nMsg = GUIGetMsg()
        Select
                Case $nMsg = $Button1
                        WinActivate(_my_ffs())

                Case $nMsg = $Button2
                        $oIE = _IECreate("http://www.sina.com.cn/", 1, 1, 0)

                Case $nMsg = $Button3
                        $oIE = _IECreate("http://www.autohome.com.cn/", 1, 1, 0)
                Case $nMsg = $Button4
                        WinActivate(_my_ffs())
                Case $nMsg = $GUI_EVENT_CLOSE
                        ExitLoop
                Case $nMsg = $GUI_EVENT_PRIMARYDOWN
                        _SendMessage($Form1, $WM_SYSCOMMAND, $SC_MOVE + $HTCAPTION, 0)
                       

        EndSelect
WEnd

haijie1223 发表于 2012-6-22 21:14:54

$Form1 = GUICreate("测试", 450, 60, 520, 1)
$Button1 = GUICtrlCreateButton("123开始", 10, 10, 100, 40, 0)
$Button2 = GUICtrlCreateButton("新浪", 120, 10, 100, 40, 0)
$Button3 = GUICtrlCreateButton("汽车", 230, 10, 100, 40, 0)
$Button4 = GUICtrlCreateButton("好网", 340, 10, 100, 40, 0)
GUISetState(@SW_SHOW)
WinSetOnTop($Form1,"",1)

While 1
        $nMsg = GUIGetMsg()
        Select
                Case $nMsg = -3
                        Exit
                Case $nMsg = $Button1
                        ShellExecute("http://www.hao123.com/")
                Case $nMsg = $Button2
                        ShellExecute("http://www.sina.com.cn/")
                Case $nMsg = $Button3
                        ShellExecute("http://www.autohome.com.cn/")
                Case $nMsg = $Button4
                        ShellExecute("http://www.hao123.com/")
        EndSelect
WEnd

简单栽培 发表于 2012-6-22 21:32:24

RE: 第一次写脚本,程序不能连续运行,请高人指点

回复 3# zerobin


    谢谢指点!!!!!!!

简单栽培 发表于 2012-6-22 21:32:52

回复 4# happytc


    谢谢指点!!!!

简单栽培 发表于 2012-6-22 21:33:52

回复 5# haijie1223


    谢谢指点!!!!!!!!!!
页: [1]
查看完整版本: 第一次写脚本,程序不能连续运行,请高人指点(已解决)