|
本帖最后由 lvsea2008 于 2009-8-30 11:20 编辑
自己学编写一个GUI,但是现在有个问题,点了第一个按钮后,想换个,比如点第2个按钮就没有用,那个网页不能出来代码如下,因播放地址还没找到暂时用hao123来替代!
请指正下谢谢!
#include <GUIConstants.au3>
GUICreate("轻松一刻",500,380,194,116,-1,-1,WinGetHandle(AutoItWinGetTitle()))
GUISetState ()
$b1 = GUICtrlCreateButton ("视听享受", 0,0,61,30)
$b2 = GUICtrlCreateButton ("网络电视1",61,0,61,30)
$b3 = GUICtrlCreateButton ("网络电视2",122,0,61,30)
$b4 = GUICtrlCreateButton ("网址大全",183,0,61,30)
While 1
$msg = GUIGetMsg()
If $msg = $b1 Then
GUISetState(@SW_SHOW)
$os = ObjCreate("Shell.Explorer.2")
$GUIActiveX= GUICtrlCreateObj($os, 0,0 ,300,500)
$os.navigate("http://www.hao123.com/")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
EndIf
If $msg = $b2 Then
GUISetState(@SW_SHOW)
$oIE = ObjCreate("Shell.Explorer.2")
$GUIActiveX= GUICtrlCreateObj( $oIE,-2,-3,500,375 )
$oIE.navigate("http://www.baidu.com/")
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
Wend
EndIf
If $msg = $b3 Then
$oIE = ObjCreate("Shell.Explorer.2")
$GUIActiveX= GUICtrlCreateObj( $oIE,-2,-3,500,375 )
GUISetState () ;Show GUI
$oIE.navigate("http://www.163.com/")
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
Wend
EndIf
If $msg = $b4 Then
$url = "http://www.hao123.com/"
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe -new " & $url)
EndIf
wend |
|