name22

Synchronise Input Controls via WM_COMMAND

May 12th, 2013
124
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <WindowsConstants.au3>
  2. #include <GUIConstants.au3>
  3. #include <EditConstants.au3>
  4. #include <Winapi.au3>
  5.  
  6. $hGUI = GUICreate("Test", 200, 100)
  7. $cInput1 = GUICtrlCreateInput("", 5, 5, 190, 25)
  8. $cInput2 = GUICtrlCreateInput("", 5, 35, 190, 25)
  9. GUISetState()
  10.  
  11. GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")
  12.  
  13. While True
  14.     Switch GUIGetMsg()
  15.         Case $GUI_EVENT_CLOSE
  16.             Exit
  17.     EndSwitch
  18. WEnd
  19.  
  20. Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
  21.     If $WM_COMMAND = $iMsg Then
  22.         Switch $hWnd
  23.             Case $hGUI
  24.                 Switch BitAND($wParam, 0xFFFF)
  25.                     Case $cInput1
  26.                         Switch BitShift($wParam, 16)
  27.                             Case $EN_CHANGE
  28.                                 GUICtrlSetData($cInput2, GUICtrlRead($cInput1))
  29.                         EndSwitch
  30.                 EndSwitch
  31.         EndSwitch
  32.     EndIf
  33. EndFunc   ;==>_WM_COMMAND
RAW Paste Data