創(chuàng)建 ActiveX 控件.
GUICtrlCreateObj ( 對象變量, 左距, 頂距 [, 寬度 [, 高度]]
)
對象變量 | 先前打開的對象變量名稱 |
左距 | 控件左側(cè)的位置. 若此值為 -1, 則根據(jù) GUICoordMode 的設(shè)置計算左側(cè)位置. |
頂距 | 控件上方的位置. 若此值為 -1, 則根據(jù) GUICoordMode 的設(shè)置計算頂部位置. |
寬度 | [可選參數(shù)] 控件的寬度(默認使用先前的寬度). |
高度 | [可選參數(shù)] 控件的高度(默認使用先前的高度). |
成功: | 返回控件標(biāo)識符(控件ID). |
失敗: | 返回 0. |
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Example()
; 簡單示例: 嵌入Internet Explorer對象到 AutoIt
GUI
;
; 參見:
http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp
Func Example()
Local
$oIE, $GUI_Button_Back, $GUI_Button_Forward
Local
$GUI_Button_Home,
$GUI_Button_Stop,
$msg
$oIE
= ObjCreate("Shell.Explorer.2")
; 為輸出創(chuàng)建一個簡單的
GUI
GUICreate("嵌入
Web 控件測試", 640, 580, (@DesktopWidth - 640)
/ 2, (@DesktopHeight - 580) /
2, BitOR($WS_OVERLAPPEDWINDOW,
$WS_CLIPSIBLINGS,
$WS_CLIPCHILDREN))
GUICtrlCreateObj($oIE, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("返回",
10, 420, 100, 30)
$GUI_Button_Forward =
GUICtrlCreateButton("向前",
120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("主頁",
230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("停止",
330, 420, 100, 30)
GUISetState() ;顯示 GUI
$oIE.navigate("http://www.autoitscript.com")
;
等待用戶關(guān)閉窗口
While
1
$msg = GUIGetMsg()
Select
Case $msg
= $GUI_EVENT_CLOSE
ExitLoop
Case $msg
= $GUI_Button_Home
$oIE.navigate("http://www.autoitscript.com")
Case $msg
= $GUI_Button_Back
$oIE.GoBack
Case $msg
= $GUI_Button_Forward
$oIE.GoForward
Case $msg
= $GUI_Button_Stop
$oIE.Stop
EndSelect
WEnd
GUIDelete()
EndFunc ;==>Example
provider with jb51.net (unicode) |