回复 1# candy_王子
#include <Misc.au3>
#include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Opt('TrayAutoPause', 0)
Global $hTimerProc = DllCallbackRegister('_TimerProc', 'none', 'hwnd;uint;uint_ptr;dword')
Global $hTimerProc2 = DllCallbackRegister('_TimerProc2', 'none', 'hwnd;uint;uint_ptr;dword')
Global $Count = 0, $Count2 = 0
_WinAPI_SetTimer(0, 0, 1000, DllCallbackGetPtr($hTimerProc))
_WinAPI_SetTimer(0, 0, 1000, DllCallbackGetPtr($hTimerProc2))
Do
Sleep(100)
Until _IsPressed('1B') ;ESC
DllCallbackFree($hTimerProc)
DllCallbackFree($hTimerProc2)
Func _TimerProc($hWnd, $iMsg, $iTimerId, $iTime)
$Count += 1
ConsoleWrite($Count & @CR)
EndFunc ;==>_TimerProc
Func _TimerProc2($hWnd, $iMsg, $iTimerId, $iTime)
$Count2 += 1
If Not WinExists('[CLASS:Notepad]') Then ShellExecute('notepad.exe')
WinWait('[CLASS:Notepad]')
ControlSend('[CLASS:Notepad]', '', 'Edit1', $Count2 & @CR)
EndFunc ;==>_TimerProc2
|