关于_WinAPI_PostMessage(已解决)
本帖最后由 shenrenba 于 2010-9-21 13:55 编辑谁知道应该怎么简化 这样每个字符需要1个命令 也太长了
-------------------------------
不要说用send 这样是为了突破输入法限制的
Dim Const $WM_CHAR = 0x102
Run('notepad.exe')
Opt('WinTitleMatchMode', 4)
WinWait("", '', 10)
$hNote = WinGetHandle("")
Opt('WinTitleMatchMode', 1)
$hEdit = ControlGetHandle($hNote, '', 'Edit1')
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("w"), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("w"), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("w"), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("."), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("b"), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("a"), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("i"), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("d"), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("u"), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("."), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("c"), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("o"), 0)
_WinAPI_PostMessage($hEdit, $WM_CHAR, Asc("m"), 0)
Func _WinAPI_PostMessage($hWnd, $iMsg, $iwParam, $ilParam)
Local $aResult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hWnd, "uint", $iMsg, "wparam", $iwParam, "lparam", $ilParam)
If @error Then Return SetError(@error, @extended, False)
Return $aResult
EndFunc
循环赛。。。。。 回复 1# shenrenba
在剪切板中写入"www.baidu.com"
然后用Send("^v")粘贴剪切板中的内容,和你代码效果是一样的Dim Const $WM_CHAR = 0x102
Run('notepad.exe')
Opt('WinTitleMatchMode', 4)
WinWait("", '', 10)
$hNote = WinGetHandle("")
Opt('WinTitleMatchMode', 1)
$hEdit = ControlGetHandle($hNote, '', 'Edit1')
ClipPut("www.baidu.com")
_WinAPI_PostMessage($hEdit, $WM_CHAR, Send("^v"), 0)
Func _WinAPI_PostMessage($hWnd, $iMsg, $iwParam, $ilParam)
Local $aResult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hWnd, "uint", $iMsg, "wparam", $iwParam, "lparam", $ilParam)
If @error Then Return SetError(@error, @extended, False)
Return $aResult
EndFunc ;==>_WinAPI_PostMessage 回复 3# lixiaolong
思路比我强 我就没想到你这样直接突破了限制 连_WinAPI_PostMessage函数都不需要了 学习学习! _WinAPI_PostMessage 这个函数我还没学过那,继续努力,可可
页:
[1]