
VB中如何虚拟按下鼠标左键
2个回答
展开全部
下面两个的答案一点用都没有。
模拟鼠标操作首先你要先把鼠标移到正确位置。
SetCursorPos
'这个API可以解决问题
然后就是模拟点击
mouse_event
'这个API就可以模拟点击了
模拟鼠标操作首先你要先把鼠标移到正确位置。
SetCursorPos
'这个API可以解决问题
然后就是模拟点击
mouse_event
'这个API就可以模拟点击了
展开全部
用api
private
declare
function
postmessage
lib
"user32"
alias
"postmessagea"
(byval
hwnd
as
long,
byval
wmsg
as
long,
byval
wparam
as
long,
byval
lparam
as
long)
as
long
private
const
wm_lbuttondown
=
&h201
private
const
wm_lbuttonup
=
&h202
private
sub
command1_click()
postmessage
command2.hwnd,
&h201,
0&,
0&
postmessage
command2.hwnd,
&h202,
0&,
0&
end
sub
private
sub
com缉梗光妓叱幻癸潍含璃mand2_click()
static
i
as
long
i
=
i
+
1
print
"command2按钮点了"
&
i
&
"次"
end
sub
private
declare
function
postmessage
lib
"user32"
alias
"postmessagea"
(byval
hwnd
as
long,
byval
wmsg
as
long,
byval
wparam
as
long,
byval
lparam
as
long)
as
long
private
const
wm_lbuttondown
=
&h201
private
const
wm_lbuttonup
=
&h202
private
sub
command1_click()
postmessage
command2.hwnd,
&h201,
0&,
0&
postmessage
command2.hwnd,
&h202,
0&,
0&
end
sub
private
sub
com缉梗光妓叱幻癸潍含璃mand2_click()
static
i
as
long
i
=
i
+
1
"command2按钮点了"
&
i
&
"次"
end
sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询