回复 5# xiehuahere - #include <GUIComboBox.au3>
- Global $Struct = DllStructCreate($tagPoint)
- GUICreate('test', 200, 150)
- $Combo = GUICtrlCreateCombo('Default text', 20, 30, 130, 26)
- GUICtrlSetFont(-1, 12, 400, 0, 'Arial')
- $Label = GUICtrlCreateLabel("Text here", 20, 90, 120, 30)
- GUISetState()
- While 1
- $msg = GUIGetMsg()
- Switch $msg
- Case -3
- Exit
- Case -7 ;$GUI_EVENT_PRIMARYDOWN
- _Test()
- EndSwitch
- WEnd
- Func _Test()
- DllStructSetData($Struct, 'x', MouseGetPos(0))
- DllStructSetData($Struct, 'y', MouseGetPos(1))
- Local $tPointCast = DllStructCreate('int64', DllStructGetPtr($Struct))
- Local $aResult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "int64", DllStructGetData($tPointCast, 1))
- If @error Then Return
- Local $aC = DllCall('user32.dll', 'int', 'GetClassNameW', 'hwnd', $aResult[0], 'wstr', '', 'int', 4096)
- If $aC[2] == 'Edit' Or $aC[2] == 'ComboBox' Then
- If _GUICtrlComboBox_GetEditText($Combo) == 'Default text' Then GUICtrlSetData($Combo, '')
- Else
- _GUICtrlComboBox_SetEditText($Combo, 'Default text')
- GUICtrlSetState($Label, 0x100) ;$GUI_FOCUS = 0x100
- EndIf
- EndFunc ;==>_Test
复制代码 |