Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Screen coordinates of mouse position?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00258766
Message ID:
00259225
Views:
33
>>Is there a way to find the Windows Desktop coordinates of the mouse when the mouse is over a FoxPro screen? I don't want the coordinates within the FoxPro screen or form.
>
>Hi Ivan,
>
>The problem with getting the form's top and left coordinates is that they aren't absolute. They're relative to the VFP desktop. The easiest way to get the absolute coordinates is to first load Foxtools and then
>* lccaption is the caption of the form of interest
>lnhWnd = _WhTohWnd(_WFindTitl(lccaption))
>STORE 0 TO lnTop, lnLeft, lnBottom, lnRight
>= _GetWRect(nHwnd, @lnTop, @lnLeft, @lnBottom, @lnRight)
>The lnTop and lnLeft values will be the absolute coordinates. From there you'll have to calculate.

Thanks for your reply. I don't think that will work. I should have been given a more complete description of what I am doing. I want to make a top level form moveable without a standard windows title bar. I want to be able to click on a portion of the form and drag the entire form around the windows desktop. I think can do it in the mouse down event and looping while MDOWN() if I know the absolute mouse coordinates within the windows desktop. This is the code I am using that almost works:

LPARAMETERS nButton, nShift, nXCoord, nYCoord
LOCAL lnLastMrow, lnLastMCol
IF nButton = 1
lnLastMrow = MROW("",3)
lnLastMCol = MCOL("",3)
DO WHILE MDOWN()
ThisForm.Top = ThisForm.Top + (MROW("",3) - lnLastMrow)
ThisForm.Left = ThisForm.Left + (MCOL("",3) - lnLastMcol)

lnLastMrow = MROW("",3)
lnLastMCol = MCOL("",3)
ENDDO
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform