#include <WinAPIConstants.au3>
#include <WinAPI.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $SIZE = 30 ,$Edit_Number =1
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("左键或者右键双击Edit修改内容", 415, 437, -1, -1)
Global $Edit1 = GUICtrlCreateEdit("Edit1", 10, 10, 345, 121)
Global $Edit2 = GUICtrlCreateEdit("Edit2", 10, 140, 345, 121)
Global $Edit3 = GUICtrlCreateEdit("Edit3", 10, 270, 345, 121)
Global $hEdit1_CallBack = DllCallbackRegister("Edit_CallBackFunc1", "int", "hWnd;uint;wparam;lparam")
Global $pEdit1_CallBack = DllCallbackGetPtr($hEdit1_CallBack)
Global $hOEdit1_CallBack = _WinAPI_SetWindowLong(GUICtrlGetHandle($Edit1), $GWL_WNDPROC, $pEdit1_CallBack)
Global $hEdit2_CallBack = DllCallbackRegister("Edit_CallBackFunc2", "int", "hWnd;uint;wparam;lparam")
Global $pEdit2_CallBack = DllCallbackGetPtr($hEdit2_CallBack)
Global $hOEdit2_CallBack = _WinAPI_SetWindowLong(GUICtrlGetHandle($Edit2), $GWL_WNDPROC, $pEdit2_CallBack)
Global $hEdit3_CallBack = DllCallbackRegister("Edit_CallBackFunc3", "int", "hWnd;uint;wparam;lparam")
Global $pEdit3_CallBack = DllCallbackGetPtr($hEdit3_CallBack)
Global $hOEdit3_CallBack = _WinAPI_SetWindowLong(GUICtrlGetHandle($Edit3), $GWL_WNDPROC, $pEdit3_CallBack)
$Form2 = GUICreate("请在Edit中输入修改后的内容", 600, 200, 627, 422)
$Edit4 = GUICtrlCreateEdit("Edit4", 10, 10, 580, 190)
GUICtrlSetFont($Edit4, $SIZE)
GUISetState(@SW_SHOW, $Form1)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[0]
Case $GUI_EVENT_CLOSE
Switch $nMsg[1]
Case $Form1
Exit
Case $Form2
GUISetState(@SW_HIDE, $Form2)
If $Edit_Number = 1 Then
GUICtrlSetData($Edit1, GUICtrlRead($Edit4))
ElseIf $Edit_Number = 2 Then
GUICtrlSetData($Edit2, GUICtrlRead($Edit4))
ElseIf $Edit_Number = 3 Then
GUICtrlSetData($Edit3, GUICtrlRead($Edit4))
EndIf
EndSwitch
EndSwitch
WEnd
Func Edit_CallBackFunc1($hWnd, $iMsg, $wParam, $lParam)
Switch $iMsg
Case $WM_LBUTTONDBLCLK
$Edit_Number = 1
GUICtrlSetData($Edit4, GUICtrlRead($Edit1))
GUISetState(@SW_SHOW, $Form2)
Case $WM_RBUTTONUP
Local Static $ClicksStartTime, $OneClick = False
If TimerDiff($ClicksStartTime) > 500 Then
$ClicksStartTime = TimerInit()
$OneClick = True
Return 1
EndIf
If $OneClick Then
$Edit_Number = 1
GUICtrlSetData($Edit4, GUICtrlRead($Edit1))
GUISetState(@SW_SHOW, $Form2)
EndIf
Return 1
EndSwitch
Return _WinAPI_CallWindowProc($hOEdit1_CallBack, $hWnd, $iMsg, $wParam, $lParam)
EndFunc ;==>Edit_CallBackFunc
Func Edit_CallBackFunc2($hWnd, $iMsg, $wParam, $lParam)
Switch $iMsg
Case $WM_LBUTTONDBLCLK
$Edit_Number = 2
GUICtrlSetData($Edit4, GUICtrlRead($Edit2))
GUISetState(@SW_SHOW, $Form2)
Case $WM_RBUTTONUP
Local Static $ClicksStartTime, $OneClick = False
If TimerDiff($ClicksStartTime) > 500 Then
$ClicksStartTime = TimerInit()
$OneClick = True
Return 1
EndIf
If $OneClick Then
$Edit_Number = 2
GUICtrlSetData($Edit4, GUICtrlRead($Edit2))
GUISetState(@SW_SHOW, $Form2)
EndIf
Return 1
EndSwitch
Return _WinAPI_CallWindowProc($hOEdit2_CallBack, $hWnd, $iMsg, $wParam, $lParam)
EndFunc ;==>Edit_CallBackFunc
Func Edit_CallBackFunc3($hWnd, $iMsg, $wParam, $lParam)
Switch $iMsg
Case $WM_LBUTTONDBLCLK
$Edit_Number = 3
GUICtrlSetData($Edit4, GUICtrlRead($Edit3))
GUISetState(@SW_SHOW, $Form2)
Case $WM_RBUTTONUP
Local Static $ClicksStartTime, $OneClick = False
If TimerDiff($ClicksStartTime) > 500 Then
$ClicksStartTime = TimerInit()
$OneClick = True
Return 1
EndIf
If $OneClick Then
$Edit_Number = 3
GUICtrlSetData($Edit4, GUICtrlRead($Edit3))
GUISetState(@SW_SHOW, $Form2)
EndIf
Return 1
EndSwitch
Return _WinAPI_CallWindowProc($hOEdit3_CallBack, $hWnd, $iMsg, $wParam, $lParam)
EndFunc ;==>Edit_CallBackFunc