How Can you Tell if Mouse is outside Window?

Blitz3D Forums/Blitz3D Programming/How Can you Tell if Mouse is outside Window?

Midnight(Posted 2008) [#1]
I did a search on the site since I thought this was an obvious thing, but couldn't find any reference to it.

In Blitz3D windowed mode, is there a way of telling if the mouse is pointing somewhere outside the window? MouseX/Y just shows the last available position from inside the window, and I'd like to blend out the game's mousepointer if the user is outside the window.

Is this possible?


Leon Drake(Posted 2008) [#2]
you'll probably need to use some winapi commands to check that.


big10p(Posted 2008) [#3]
Yep.


Kev(Posted 2008) [#4]
when you say leaving the blitz3d window, you mean while still active? if so! heres one possable method.

you would need to create a .decls
.lib "user32.dll"
GetCursorPos%(lppoint*):"GetCursorPos"
WindowFromPoint%(lppoint*):"WindowFromPoint"


now get the blitz3d hwnd pointer using SystemProperty("AppHwnd") and check against the hwnd pointer returned from the api call WindowFromPoint()

bank = createbank(8)
GetCursorPos(bank)
hwnd_under_pointer = WindowFromPoint(bank)
blitz3d_hwnd = SystemProperty("AppHwnd")

this is untested but should work.

kev


Snarkbait(Posted 2008) [#5]
When my cat is really interested at something outside, there might be a mouse outside the window...


ba-dump-bump!


Oiduts Studios(Posted 2008) [#6]
if the mousex() and mousey() is > gaphicswidth() and graphicsheight() then it is gone


TomToad(Posted 2008) [#7]
@blitz monkey:
That doesn't work. When the mouse leaves the window, MouseX() and MouseY() stop updating.


Oiduts Studios(Posted 2008) [#8]
ya ya i just tested it opps... i feel stupid