Function Reference

_GUICtrlRichEdit_SetPasswordChar

入力された文字の代わりに表示される文字の設定、取り消しをおこないます。

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetPasswordChar($hWnd[, $cDisplayChar = "0"])

 

パラメータ

$hWnd コントロールのハンドル
$cDisplayChar [オプション] ユーザーによって入力された文字の代わりに表示される文字
特殊な値: "" - 入力された文字が表示されます。

 

返し値

成功: True
失敗: Falseを返し、@errorを設定します。
@error: 101 - $hWndがハンドルではありません。
102 - $cDisplayCharが文字ではありません。

 

注意

なし。

 

関連

_GUICtrlRichEdit_GetPasswordChar

 

こちらも参照

MSDNライブラリでEM_SETPASSWORDCHARを検索して下さい。

 


#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
    Local $hGui, $iMsg, $btnNext, $iStep = 0
    $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
            BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    $lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
    $btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
    GUISetState()

    Report("Initial state after creation:")

    While True
        $iMsg = GUIGetMsg()
        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                GUIDelete()
                Exit
            Case $iMsg = $btnNext
                $iStep += 1
                Switch $iStep
                    Case 1
                        _GUICtrlRichEdit_SetPasswordChar($hRichEdit, "*")
                        Report("Changed password character. Type some text")
                    Case 2
                        _GUICtrlRichEdit_SetPasswordChar($hRichEdit, "")
                        Report("Changed it back")
                        GUICtrlSetState($btnNext, $GUI_DISABLE)
                EndSwitch
        EndSelect
    WEnd
EndFunc   ;==>Main

Func Report($sMsg)
    Local $ch
    $ch = _GUICtrlRichEdit_GetPasswordChar($hRichEdit)
    If $ch = "" Then
        $sMsg &= @CR & "Characters appear as typed"
    Else
        $sMsg = $sMsg & @CR & "Typed characters appear as " & $ch & "s"
    EndIf
    GUICtrlSetData($lblMsg, $sMsg)
    ControlFocus($hRichEdit, "", "")
EndFunc   ;==>Report