>I followed a thread here a while back regarding the DOEVENTS command and that it required the mouse to move in order for it to really take effect. Since then, I've done a .DoFastEvents() which moves the mouse 1 pixel and it works great, but...... there could be several forms up at any given time and the mouse may not be over the active form when this method is called. I'm often finding my mouse shooting over to the far left as MROW() or MCOL() is returning -1. How can I absolutely determine the x & y of the mouse, move it and then return it to it's exact position regardless of what form is active and where the mouse it.
>
Hi Steve,
One thing that could cause problems with this is the mouse cursor being outside either the active window or the main FoxPro window. However, you can position the mouse cursor so that DoFastEvents (thank you, David) will always move the mouse point. First, make sure that foxtools is loaded, then:
DECLARE mouse_event IN Win32API;
INTEGER dwFlags, INTEGER dx,;
INTEGER dy, INTEGER dwData,;
INTEGER dwExtraInfo
#define MOUSEEVENTF_MOVE 0x0001
#define MOUSEEVENTF_ABSOLUTE 0x8000
lnflags = BITOR(MOUSEEVENTF_MOVE, MOUSEEVENTF_ABSOLUTE)
lnwhandle = _WFindTitl(_SCREEN.ActiveForm.Caption)
lnhwnd = _WhTohWnd(lnwhandle)
STORE 0 TO lnTop, lnLeft, lnBottom, lnRight
= _GetWRect(lnhwnd, @lnTop, @lnLeft, @lnBottom, @lnRight)
lntop = (lntop + 30) * (65535 / SYSMETRIC(2))
lnleft = (lnleft + 20) * (65535 / SYSMETRIC(1))
= mouse_event(lnflags, lnleft, lntop, 0, 0)
This will position the cursor in the upper left portion of the active form so that David's code is sure to move the mouse.
Personal side note - You in your new house yet?
George
Ubi caritas et amor, deus ibi est