Window Focus

Blitz3D Forums/Blitz3D Programming/Window Focus

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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