Declare short GetCursorPos In win32api String @ lpPoint DECLARE SHORT GetWindowRect IN user32 INTEGER hwnd, STRING @lpRect DECLARE INTEGER GetActiveWindow IN WIN32API3. Add the new method to the form to deal with outputs of the functions above, like:
*form.dword2num: PARAMETERS lcBuffer RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ; BitLShift(Asc(SUBSTR(lcBuffer, 2,1)), 8) +; BitLShift(Asc(SUBSTR(lcBuffer, 3,1)), 16) +; BitLShift(Asc(SUBSTR(lcBuffer, 4,1)), 24)4. Add the following code to the Timer.Timer event:
* Timer.Timer lpPoint = Space(8) If GetCursorPos(@lpPoint)#0 mouseX = thisform.dword2num(SUBSTR(lpPoint, 1,4)) mouseY = thisform.dword2num(SUBSTR(lpPoint, 5,4)) Endif cRect = Repli(Chr(0), 16) = GetWindowRect(thisform.hwnd, @cRect) WITH thisform FormLeft = .dword2num(SUBSTR(cRect, 1,4)) FormTop = .dword2num(SUBSTR(cRect, 5,4)) FormRight = .dword2num(SUBSTR(cRect, 9,4)) FormBottom = .dword2num(SUBSTR(cRect, 13,4)) ENDWITH cRect = Repli(Chr(0), 16) = GetWindowRect(_VFP.hwnd, @cRect) WITH thisform VFPLeft = .dword2num(SUBSTR(cRect, 1,4)) VFPTop = .dword2num(SUBSTR(cRect, 5,4)) VFPRight = .dword2num(SUBSTR(cRect, 9,4)) VFPBottom = .dword2num(SUBSTR(cRect, 13,4)) ENDWITH llMouseDown_OutofVFPScreen=NOT (between(mouseX, VFPLeft, VFPRight) AND; between(mouseY, VFPTop, VFPBottom)) ; AND NOT INLIST(GetActiveWindow(), _VFP.HWND, _screen.Hwnd, thisform.HWnd) llMouseDown_In_VFPScreen_but_OutofForm = MDOWN() AND NOT (; between(mouseX, FormLeft, FormRight) AND; between(mouseY, FormTop, FormBottom) ) IF llMouseDown_OutofVFPScreen OR llMouseDown_In_VFPScreen_but_OutofForm thisform.release endifGOod Luck