IT-Programing Help part 75 pps

6 77 0
IT-Programing Help part 75 pps

Đang tải... (xem toàn văn)

Thông tin tài liệu

$a[1])) EndIf Until $msg = $GUI_EVENT_CLOSE Function Reference GUICtrlSendMsg Send a message to a control. GUICtrlSendMsg ( controlID, msg , wParam, lParam ) Parameters controlID The control identifier (controlID) as returned by a GUICtrlCreate function. msg type of message to be send to the control as defined in the Windows control documentation. wParam The first param to send to the control. lParam The second param to send to the control. Return Value Success: Returns the value returned by the SendMessage Windows API. Failure: Returns 0. Remarks This function allows the sending of special Windows messages directly to the control using the SendMessage API. It is used to enable special control features not available with the simple GUICtrlRead() and GUICtrlSet () range of functions. The parameters (wParam and lParam) can be an integer or a string. GUICtrlSendMsg should be used for messages that have no special return types. For more advanced messages where you must be able to receive extra data you must use GUICtrlRecvMsg(). Related GUICtrlRecvMsg, GUICtrlCreate , GUICtrlSet , GUIGetMsg, GUICtrlRead Example #include <GUIConstantsEx.au3> #include <EditConstants.au3> GUICreate("My GUI") ; will create a dialog box that when displayed is centered $nEdit = GUICtrlCreateEdit ("line 0", 10,10) GUICtrlCreateButton ("Ok", 20,200,50) GUISetState () For $n=1 To 5 GUICtrlSetData ($nEdit,@CRLF & "line "& $n) Next ; Run the GUI until the dialog is closed Do $msg = GUIGetMsg() If $msg >0 Then $n=GUICtrlSendMsg ($nEdit, $EM_LINEINDEX,-1,0) $nline=GUICtrlSendMsg( $nEdit, $EM_LINEFROMCHAR,$n,0) GUICtrlSetState ($nEdit,$GUI_FOCUS) ; set focus MsgBox (0,"Currentline",$nLine) EndIf Until $msg = $GUI_EVENT_CLOSE Function Reference GUICtrlSendToDummy Sends a message to a Dummy control. GUICtrlSendToDummy ( controlID [, state] ) Parameters controlID The control identifier (controlID) as returned by GUICtrlCreateDummy state [optional] value that can be retrieved later on by GUICtrlRead Return Value Success: Returns 1. Failure: Returns 0. Remarks When this function is called a notification that can be handled through the message loop or with a OnEvent function is generated (as if the control had been "clicked" on). Related GUICtrlCreateDummy, GUICtrlSetOnEvent, GUICtrlRead Example #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Global $user Example() Func Example() Local $iOldOpt, $button $iOldOpt = Opt("GUIOnEventMode", 1) GUICreate("GUISendToDummy", 220, 200, 100, 200) GUISetBkColor(0x00E0FFFF) ; will change background color GUICtrlSetOnEvent($GUI_EVENT_CLOSE, "OnClick") ; to handle click on button $user = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, "Onexit") ; to handle click on button $button = GUICtrlCreateButton("event", 75, 170, 70, 20) GUICtrlSetOnEvent(-1, "OnClick") ; to handle click on button GUISetState() While 1 Sleep(100) WEnd Opt("GUIOnEventMode", $iOldOpt) EndFunc ;==>Example Func OnClick() GUICtrlSendToDummy($user) ; fired dummy control EndFunc ;==>OnClick Func OnExit() ; special action before exiting Exit EndFunc ;==>OnExit Function Reference AutoItSetOption Changes the operation of various AutoIt functions/parameters. AutoItSetOption ( "option" [, param] ) Parameters option The option to change. See Remarks. param [optional] The value to assign to the option. The type and meaning vary by option. See remarks below. If the param is not provided, then the function just returns the value already assigned to the option. The keyword Default can be used for the parameter to reset the option to its default value. Return Value Returns the value of the previous setting for the option. Remarks You may use Opt() as an alternative to AutoItSetOption(). AutoIt will halt with an error message if the requested option is unknown. Options are as follows: Option Param CaretCoordMode Sets the way coords are used in the caret functions, either absolute coords or coords relative to the current active window: 0 = relative coords to the active window 1 = absolute screen coordinates (default) 2 = relative coords to the client area of the active window . "Onexit") ; to handle click on button $button = GUICtrlCreateButton("event", 75, 170, 70, 20) GUICtrlSetOnEvent(-1, "OnClick") ; to handle click on button GUISetState()

Ngày đăng: 05/07/2014, 07:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan