08-18-2023, 12:05 PM
See if this doesn't tell you what you want to know:
These two screenmoves will position the program section (not the title bar) where you specify. All you need to do is check against them to see if you're in window, or not.
Code: (Select All)
Type POINTAPI
x As Long
y As Long
End Type
Dim apixy As POINTAPI 'mouse x/y for the GetCursorPos function
Declare Dynamic Library "user32" 'get current mouse x/y position
Function GetCursorPos% (lpPoint As POINTAPI) 'http://allapi.mentalis.org/apilist/GetCursorPos.shtml
End Declare
Screen 12
sx = 100: sy = 100
ScreenMove sx, sy
Do
'poll mouse x/y
tmp = GetCursorPos(apixy)
ax = apixy.x: ay = apixy.y
Cls: Print "MOUSE IN"
If ax - sx < 0 Then Cls: Print "MOUSE OUT"
If ax - sx > _Width Then Cls: Print "MOUSE OUT"
If ay - sy < 0 Then Cls: Print "MOUSE OUT"
If ay - sy > _Height Then Cls: Print "MOUSE OUT"
_Display
Loop
Sub ScreenMove_Middle
$If BORDERDEC = UNDEFINED Then
$Let BORDERDEC = TRUE
Declare Library
Function glutGet& (ByVal what&)
End Declare
$End If
BorderWidth = glutGet(506)
TitleBarHeight = glutGet(507)
_ScreenMove (_DesktopWidth - _Width - BorderWidth) / 2 + 1, (_DesktopHeight - _Height - BorderWidth) / 2 - TitleBarHeight + 1
End Sub
Sub ScreenMove (x, y)
$If BORDERDEC = UNDEFINED Then
$LET BORDERDEC = TRUE
DECLARE LIBRARY
FUNCTION glutGet& (BYVAL what&)
END DECLARE
$End If
BorderWidth = glutGet(506)
TitleBarHeight = glutGet(507)
_ScreenMove x - BorderWidth, y - BorderWidth - TitleBarHeight
End Sub
These two screenmoves will position the program section (not the title bar) where you specify. All you need to do is check against them to see if you're in window, or not.