更专业一点,最小化后才操作
#include <WinAPI.au3>
#include <SendMessage.au3>
Run(@SystemDir & "\calc.exe")
WinWait("计算器","",5);等待5秒
$Hwnd = WinGetHandle("计算器")
_WinAPI_ShowWindow($Hwnd,@SW_HIDE ) ;最小化计算器
MsgBox(262208,"","计算器被最小化")
;-------点击清除键C
_SendMessage(_WinAPI_GetDlgItem($Hwnd, 81), 0x0201, 0)
_SendMessage(_WinAPI_GetDlgItem($Hwnd, 81), 0x0202, 0)
;-------点击5
_SendMessage(_WinAPI_GetDlgItem($Hwnd, 129), 0x0201, 0)
_SendMessage(_WinAPI_GetDlgItem($Hwnd, 129), 0x0202, 0)
;-------点击+
_SendMessage(_WinAPI_GetDlgItem($Hwnd, 92), 0x0201, 0)
_SendMessage(_WinAPI_GetDlgItem($Hwnd, 92), 0x0202, 0)
;-------点击5
_SendMessage(_WinAPI_GetDlgItem($Hwnd, 129), 0x0201, 0)
_SendMessage(_WinAPI_GetDlgItem($Hwnd, 129), 0x0202, 0)
;-------等于
_SendMessage(_WinAPI_GetDlgItem($Hwnd, 112), 0x0201, 0)
_SendMessage(_WinAPI_GetDlgItem($Hwnd, 112), 0x0202, 0)
;操作是点击:5+5=
MsgBox(262208,"","去看看结果是不是10!",-1,$Hwnd)
_WinAPI_ShowWindow($Hwnd,@SW_RESTORE)
WinActive($Hwnd)
|