Tải bản đầy đủ (.pdf) (6 trang)

Giáo Trình How To Use AutoIt A Professional Manner part 38 ppsx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (127.07 KB, 6 trang )



SoundPlay(@WindowsDir & "\media\tada.wav",1)




Function Reference
SoundSetWaveVolume
thiết đặt âm lượng của hệ thống
SoundSetWaveVolume ( percent )
Parameters
percent số phần trăm [0 100]

Return Value
Success:

Returns 1.
Failure:

Returns 0 và sets @error to 1 nếu pecent ko đúng.

Remarks
This controls the Wave volume, not the master volume control. Also, a value of
Zero does not set mute status.

On Windows Vista, there is no system-wide wave volume. This function only
changes the wave volume for the script. It can not be used to change the wave
volume of other programs.
Related
SoundPlay


Example

SoundSetWaveVolume(50)




Function Reference
GUICreate
tạo ra một cửa sổ.
GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] )
Parameters
title tên
width chiều rộng (mặc định = 400)
height chiều cao (mặc định = 400)
left tọa độ X (mặc định = -1: căn giữa màn hình)
top tọa độ Y (mặc định = -1: căn giữa màn hình)
style kiểu của GUI. xem thêm GUI Control Styles Appendix.

dùng -1 để mặc định tạo GUI có các kiểu sau $WS_MINIMIZEBOX,
$WS_CAPTION, $WS_POPUP, $WS_SYSMENU.

một số kiểu luôn luôn đc thêm vào:
$WS_CLIPSIBLINGS, $WS_SYSMENU
nếu $WS_MAXIMIZEBOX hay $WS_SIZEBOX được xác định .
exStyle
kiểu mở rộng của GUI. xem ở dưới Extended Style Table
mặc định là -1.
parent handle của GUI mẹ


Return Value
Success:

trả lại win handle
Failure:

Returns 0 nếu GUI ko đc tạo và set @error = 1

Remarks
mặc định GUI ko thể thay đổi kích thước và thu nhỏ đc (WS_SIZEBOX và
WS_MAXIMIZEBOX ko đc dùng trong tham số style)

để sử dụng nhiều kiểu trong style ta dùng BitOr($GUI_SS_DEFAULT_GUI,
newstyle, ).

Bảng kiểu mở rộng
kiểu mô tả
$WS_EX_ACCEPTFILES
Allow an edit or input control within the
created GUI window to receive filenames
via drag and drop. The control must have
also the $GUI_DROPACCEPTED state set
by GUICtrlSetState. for other controls the
drag&drop info can be retrieved with
@GUI_DRAGID, @GUI_DRAGFILE,
@GUIDROPID.
$WS_EX_APPWINDOW
Forces a top-level window onto the taskbar
when the window is visible.
$WS_EX_CLIENTEDGE

Specifies that a window has a border with a
sunken edge.
$WS_EX_CONTEXTHELP
Includes a question mark in the title bar of
the window. Cannot be used with the
WS_MAXIMIZEBOX or
WS_MINIMIZEBOX.
$WS_EX_DLGMODALFRAME
Creates a window that has a double border;
the window can, optionally, be created with
a title bar by specifying the WS_CAPTION
style in the style parameter.
$WS_EX_MDICHILD
C
reate a child window included in its parent
window (simulation not real MDI).
$WS_EX_OVERLAPPEDWINDOW

Combines the WS_EX_CLIENTEDGE and
WS_EX_WINDOWEDGE styles.
$WS_EX_STATICEDGE
Creates a window with a three-dimensional
border style intended to be used for items
that do not accept user input.
$WS_EX_TOPMOST
Specifies that a window created with this
style should be placed above all non-
topmost windows and should stay above
them, even when the window is deactivated.


$WS_EX_TRANSPARENT
The window appears transparent because
the bits of underlying sibling windows have
already been painted.
$WS_EX_TOOLWINDOW
tạo ra một cửa sổ công cụ, thanh tiêu đ
ề nhỏ
hơn, ko hiện ico trên thanh tiêu đề, ko hiện
tên trên taskbar, ko di chuyển tới cửa sổ n
ày
đc = Alt+Tab, nhưng menu hệ thống vẫn
hiện ra khi ấn Alt+Space
$WS_EX_WINDOWEDGE
Chỉ rõ rằng một cửa sổ có một biên giới với
một cạnh được nêu ra.
$WS_EX_LAYERED
tạo ra GUI ẩn, chú ý kiểu này ko dùng cho
GUI con

để sử dụng các biến trên bạn cần #include <WindowsConstants.au3>



Related
GUISet , GUICtrlCreate , GUIGetMsg, GUIGetStyle, GUIDelete,
WinGetHandle
Example

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


Opt('MustDeclareVars', 1)

Example1()
Example2()

; example 1
Func Example1()
Local $msg

GUICreate("My GUI") ; will create a dialog box that when displayed is centered
GUISetState(@SW_SHOW) ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
EndFunc ;==>Example1

; example 2
Func Example2()
Local $gui, $background, $pic, $basti_stay, $msg
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt
v3\AutoIt", "InstallDir") & "\Examples\GUI\logo4.gif"

$gui = GUICreate("Background", 400, 100)
; background picture

$background = GUICtrlCreatePic(@SystemDir & "\oobe\images\mslogo.jpg",
0, 0, 400, 100)
GUISetState(@SW_SHOW)

; transparent MDI child window
$pic = GUICreate("", 169, 68, 0, 0, $WS_POPUP,
BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui)
; transparent pic
$basti_stay = GUICtrlCreatePic($sFile, 0, 0, 169, 68)
GUISetState(@SW_SHOW)

Do
$msg = GUIGetMsg()

Until $msg = $GUI_EVENT_CLOSE
EndFunc ;==>Example2



Function Reference
GUICtrlCreateAvi
tạo ra một control AVI video cho GUI (để chạy file .avi chứ để làm gì)
GUICtrlCreateAvi ( filename, subfileid, left, top [, width [, height [, style [,
exStyle]]]] )
Parameters
filename đường dẫn tới file avi
subfileid
id của subfile sẽ được sử dụng. Nếu tập tin chỉ có chứa một đoạn
video thì dùng -1.
left Toạ độ X

top Tọa độ Y
width Chiều rộng
height chiều cao
style
kiểu. xem thêm GUI Control Styles Appendix.
mặc định = -1 : $ACS_TRANSPARENT
$ACS_TRANSPARENT sẽ luôn luôn đc dùng trừ khi
$ACS_NONTRANSPARENT đc dùng
exStyle kiểu mở rộng. xem Extended Style Table.

×