回复 6# afan
谢谢,好方法!!
我小小改了下,可以减少几行 ;-)
#include <GUIComboBox.au3>
#include <WinAPI.au3>
Global $Struct = DllStructCreate($tagPoint)
$hGUI = 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 $aC = DllCall('user32.dll', 'int', 'GetClassNameW', 'hwnd', _WinAPI_WindowFromPoint($Struct), '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
|