显示桌面的本质是个系统 Shell(IShellDispatch4.ToggleDesktop()),所以只需要调用这个 Shell 就好了,用不着模拟按键。
创新互联建站是一家集网站建设,肇东企业网站建设,肇东品牌网站建设,网站定制,肇东网站建设报价,网络营销,网络优化,肇东网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
项目引用 C:\Windows\System32\shell32.dll,参考代码:
Dim objShel As Shell32.ShellClass = New Shell32.ShellClass()
CType(objShel, Shell32.IShellDispatch4).ToggleDesktop()
Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Dim postion1 As New Point
mouse_event(H1 Or H8000, postion1.X * 65535 / 1366, postion1.Y * 65535 / 768, 0, 0)
'按绝对位置移动鼠标
'在鼠标坐标系统中,屏幕在水平和垂直方向上均匀分割成65535×65535个单元,
'当前所用显示屏分辨率为1366*768
'所以要进行如上转换
mouse_event(H2, 0, 0, 0, 0) '鼠标左键按下
mouse_event(H4, 0, 0, 0, 0) '鼠标左键弹起
msdn上有 mouse_event 的详解,大致使用如上
Public C护激篙刻蕻灸戈熏恭抹lass Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim c As Char
c = Trim(TextBox3.Text)
Select Case c
Case "+"
TextBox4.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
Case "-"
TextBox4.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
Case "*"
TextBox4.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
Case "\"
If Val(TextBox2.Text) = 0 Then
MsgBox("分母为0")
Else
TextBox4.Text = Val(TextBox1.Text) \ Val(TextBox2.Text)
End If
Case "/"
If Val(TextBox2.Text) = 0 Then
MsgBox("分母为0")
Else
TextBox4.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End If
End Select
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class
直接把消息发送给TextBox。
Dim x As Integer, y As Integer
x = 100
y = 100
PostMessage(TextBox1.Handle.ToInt32, WM_LBUTTONDOWN, MK_LBUTTON, MakeInteger(x, y))
PostMessage(TextBox1.Handle.ToInt32, WM_LBUTTONUP, MK_LBUTTON, MakeInteger(x, y))
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款