函数原型如下:
NewClick(window wWindow,integer iButton,integer iClickType,integer iXpos,integer
iYpos)
这里面:
wWindow 是包含点击操作所作用的对象的窗体
iButton 是点击使用的按键: 1=left, 2=right, 3=middle
iClickType鼠标执行的操作: 1=click, 2=doubleclick
iXpos 和 iYpos 鼠标作用在对象上的坐标
代码:
下面一段代码必须放在Frame文件的开始部分:
[-] dll "user32.dll"
[ ] mouse_event (long dwFlags ,long dx,long dy,long
cButtons,long dwExtraInfo)
[-] void NewClick(window wWindow, integer
iButton,integer iClickType, integer x, integer y)
[ ]
[ ] integer
i=0
[ ]
[ ] // various Constants to manipulate different buttons on
mouse
[ ] const MOUSEEVENTF_LEFTDOWN = 2
[ ] const MOUSEEVENTF_ABSOLUTE =
32768
[ ] const MOUSEEVENTF_LEFTUP = 4
[ ] const MOUSEEVENTF_MIDDLEDOWN =
14
[ ] const MOUSEEVENTF_MIDDLEUP = 64
[ ] const MOUSEEVENTF_MOVE = 1
[
] const MOUSEEVENTF_RIGHTDOWN = 8
[ ] const MOUSEEVENTF_RIGHTUP = 16
[ ]
[ ] //Set the click type default
[-] if(iClickType!=2)
[ ]
iClickType=1
[ ]
[ ] //Set the button default
[-] if(iButton>3
iButton==0)
[ ] iButton=1
[ ]
[ ] // Move Mouse Pointer over current
mouse object
[ ] wWindow.MoveMouse(x,y)
[ ]
[ ] //Send message to
mouse controller to press and release mouse at the specified position
[ ]
//Left mouse button
[-] if(iButton==1)
[-]
for(i=1;i<=iClickType;i++) [ ] mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) [ ] mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) [ ] [ ] //Right mouse button [-] if(iButton==2) [-] for(i=1;i<=iClickType;i++) [ ] mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0) [ ] mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0) [ ] [ ] //Middle mouse button [-] if(iButton==3) [-] for(i=1;i<=iClickType;i++) [ ] mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0) [ ] mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0) [ ] [ ] return
没有评论:
发表评论