Funktionreferenz


_WinAPI_ShowCaret


Makes the caret visible on the screen at the caret's current position

#include <WinAPIRes.au3>
_WinAPI_ShowCaret ( $hWnd )

Parameter

$hWnd Handle to the window that owns the caret. If this parameter is 0, _WinAPI_ShowCaret() searches the
current task for the window that owns the caret.

Rückgabewert

Success: True
Failure: False

Bemerkungen

_WinAPI_ShowCaret() shows the caret only if the specified window owns the caret, the caret has a shape,
and the caret has not been hidden two or more times in a row. If one or more of these conditions is not met,
_WinAPI_ShowCaret() does nothing and returns 0.

Hiding is cumulative. If your application calls _WinAPI_HideCaret() five times in a row, it must also call
_WinAPI_ShowCaret() five times before the caret reappears.

Verwandte Funktionen

_WinAPI_HideCaret

Siehe auch

Suche nach ShowCaret in der MSDN Bibliothek.

Beispiel

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPIConv.au3>
#include <WinAPIGdi.au3>
#include <WinAPIHObj.au3>
#include <WinAPIRes.au3>
#include <WindowsConstants.au3>

Global $Duration = Default, $hBitmap = _WinAPI_CreateSolidBitmap(0, 0x00AEFF, 10, 14)

OnAutoItExitRegister('OnAutoItExit')

Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 400, 93)
Local $Input = GUICtrlCreateInput('', 20, 20, 360, 20)
Local $Button = GUICtrlCreateButton('Beenden', 165, 59, 70, 23)
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $Button
            ExitLoop
    EndSwitch
WEnd

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg

    Switch $hWnd
        Case $hForm
            Switch _WinAPI_LoWord($wParam)
                Case $Input
                    Switch _WinAPI_HiWord($wParam)
                        Case $EN_KILLFOCUS
                            _WinAPI_HideCaret($lParam)
                            _WinAPI_DestroyCaret()
                            _WinAPI_SetCaretBlinkTime($Duration)
                            $Duration = Default
                        Case $EN_SETFOCUS
                            $Duration = _WinAPI_SetCaretBlinkTime(-1)
                            _WinAPI_CreateCaret($lParam, $hBitmap)
                            _WinAPI_ShowCaret($lParam)
                    EndSwitch
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

Func OnAutoItExit()
    _WinAPI_DeleteObject($hBitmap)
    If Not IsKeyword($Duration) Then
        _WinAPI_SetCaretBlinkTime($Duration)
    EndIf
EndFunc   ;==>OnAutoItExit