| 发表于:2007-07-19 17:47:174楼 得分:0 |
那就要向系统的消息队列里插入鼠标事件了 使用sendinput吧. --------------------------------------- 能再详细点吗? http://www.m5home.com/bbs/dispbbs.asp?boardid=2&id=1283&page=1 这里后面有讲到驱动级模拟的 驱动的代码也有,你看看吧 ---------------------------------------- 虽然是说键盘方面与问题相关不大,不过很值得一看,收藏了。 如果是指定窗口则sendmessage,postmessage都可以 如果是当前窗口mouse_event就可以了 ---------------------------------------- mouse_event不仅用于当前窗口,整个屏幕都有效,而且我试了很多次了,始终无法脱离鼠标,单击的地方总是鼠标所在点,即使设置了绝对位置也一样,我要的是鼠标在屏幕里的位置与单击的位置不在同个点上。我给出我的代码,帮我看下是不是哪里有问题,感觉好像是设置绝对位置比起作用。 option explicit private declare sub mouse_event lib "user32 " _ ( _ byval dwflags as long, _ byval dx as long, _ byval dy as long, _ byval cbuttons as long, _ byval dwextrainfo as long _ ) const mouseeventf_leftdown = &h2 const mouseeventf_leftup = &h4 const mouseeventf_middledown = &h20 const mouseeventf_middleup = &h40 const mouseeventf_move = &h1 const mouseeventf_absolute = &h8000 const mouseeventf_rightdown = &h8 const mouseeventf_rightup = &h10 private sub form_load() timer1.interval = 1000 timer1.enabled = true end sub '每隔一秒中模拟一次鼠标事件 private sub timer1_timer() mouse_event mouseeventf_absolute or mouseeventf_leftdown or mouseeventf_leftup, 100, 100, 0, 0 end sub 不管有没加mouseeventf_absolute,后边的参数怎么改,单击的位置始终还是屏幕鼠标所在位置,请高手过过目。 | | |
|