实时输入框,相当于VB的change()事件

前端之家收集整理的这篇文章主要介绍了实时输入框,相当于VB的change()事件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
$Form1 = GUICreate("",533,464)

$Input_1 = GuiCtrlCreateInput("",10,20,190,30)

$Label_2 = GuiCtrlCreateLabel("",220,30,130,20)

Global Const $WM_COMMAND = 0x0111

GUIRegisterMsg($WM_COMMAND,"MY_WM_COMMAND")

GUISetState()

While 1

    $msg = GUIGetMsg()

    Select

        Case $msg = -3

            ExitLoop

        Case Else

            ;;;

    EndSelect

WEnd



Func MY_WM_COMMAND($hWnd,$msg,$wParam,$lParam)

    Local Const $EN_CHANGE = 0x300

    

    Local $nNotifyCode = BitShift($wParam,16)

    Local $nID = BitAND($wParam,0xFFFF)

    Local $hCtrl = $lParam

    If $nNotifyCode = $EN_CHANGE Then GUICtrlSetData($Label_2,GUICtrlRead($Input_1));此处是实时的结果

EndFunc   ;==>MY_WM_COMMAND

猜你在找的VB相关文章