使用VB2010向指定的窗口发送鼠标单击事件,提示出错,请各位帮忙看一下!!!!!!!!!
窗体代码如下:'API函数声明
Declare Function Findwindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal Wparam As Long, ByRef lParam As Long)
Const gmeCaption As String = "祖玛豪华完全版1.22"
Const WM_LBUTTONDOWN As Long = &H201
Const WM_LBUTTONUP As Long = &H202
'子过程
Public Sub autoStart()
Dim hwnd As Long
'x=374,y=390
'x=211,y=446
hwnd = Findwindow(vbNull, gmeCaption)
PostMessage(hwnd, WM_LBUTTONDOWN, 0, &H1BE0137)
PostMessage(hwnd, WM_LBUTTONUP, 0, &H183017F)
End Sub
'过程调用 Private Sub TimAutoStart_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimAutoStart.Tick
Call autoStart()
End Sub
'复选框控制Tim控件 Private Sub ChkAutoStart_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChkAutoStart.CheckedChanged
If ChkAutoStart.Enabled = True Then
TimAutoStart.Enabled = True
End If
End Sub
'程序运行后的错误提示
托管调试助手“PInvokeStackImbalance”在“D:\Vb2010Test\Ddpwg\Ddpwg\bin\Debug\Ddpwg.vshost.exe”中检测到故障。
其他信息: 对 PInvoke 函数“Ddpwg!Ddpwg.FormDdp::PostMessage”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。
程序“[3776] Ddpwg.vshost.exe: 程序跟踪”已退出,返回值为 0 (0x0)。
程序“[3776] Ddpwg.vshost.exe: 托管(v4.0.30319)”已退出,返回值为 0 (0x0)。
注:本人是一刚学VB的新手,上面的代码运行了多次,提示都说导致堆栈不对称,实在不知道是什么原因,请各位大虾多多指教,小先这里先谢谢了^_^
--------------------编程问答-------------------- 没有大虾帮忙看看吗?自己顶一下吧 --------------------编程问答-------------------- 再顶……顶……顶…… --------------------编程问答-------------------- 外挂非法 --------------------编程问答-------------------- 把 LONG 全改为 int32 --------------------编程问答-------------------- ByVal hwnd As intprv
补充:VB , API