Window Focus
Blitz3D Forums/Blitz3D Programming/Window Focus
| ||
Hey guys, what's the best way to check and see if your Blitz app has focus? I did a search and people mentioned something like user32. http://www.blitzbasic.com/Community/posts.php?topic=63947#713762 What is that and where can I find it? If that's not the best way to go, what is? Thanks! :) |
| ||
user32 is a dll, create a file called "user32.decls" in your "userlibs" folder from this: http://www.blitzbasic.com/codearcs/codearcs.php?code=1179 Then you need the MSDN online win32 help, or get a copy of the old win32.hlp, here for example: http://www.purebasic.com/documentation/reference/ide_help.html Here is a GetFocus example. ;GetFocus example Graphics 640,480,0,2 hwnd=Api_GetFocus() ;similar commands hwnd2=Api_GetForegroundWindow() hwnd3=Api_GetActiveWindow() While Not KeyHit(1) Cls test=Api_GetFocus() If hwnd<>test Then End ;if focus not on this app then quit Text 0,0,"hwnd="+hwnd+" hwnd2="+hwnd2+" hwnd3="+hwnd3 Flip Wend |