Lost Focus

Blitz3D Forums/Blitz3D Beginners Area/Lost Focus

pc_tek(Posted 2008) [#1]
Does B3d have the equivalent of the command to detect whether it's window has 'lost focus'...ie, the user has clicked the desktop or minimised the window?


chi(Posted 2008) [#2]
;;;;; user32.decls ;;;;;
; .lib "user32.dll"
;
; api_HasFocus%() : "GetActiveWindow"
; api_IsIconic% (hwnd%) : "IsIconic"
;;;;;;;;;;;;;;;;;;;;;;;;

Global hwnd=SystemProperty("apphwnd")
Graphics3D 800,600,0,2

Repeat
	Cls
	RenderWorld

	If api_HasFocus()<>hwnd
		txt$="window lost focus"
	Else
		txt$="window has focus"
	EndIf
	
	If api_IsIconic(hwnd)
		AppTitle"minimized"
	Else
		AppTitle"windowed"
	EndIf

	Text 10,10,txt$
	Flip
Until KeyHit(1)
End



Snarkbait(Posted 2008) [#3]
How iconic! ;)


pc_tek(Posted 2008) [#4]
Ummm...is there an active link to these fabled decls? LOL


chi(Posted 2008) [#5]
User32.decls


pc_tek(Posted 2008) [#6]
Hi Chi!

The IsIconic Decl is there, but the api_HasFocus is not

Am I missing something?


chi(Posted 2008) [#7]
if its not inside user32.decls... then add it ;)

api_HasFocus%() : "GetActiveWindow"


pc_tek(Posted 2008) [#8]
Apologies for not getting back to you sooner, Chi.

My thanks for all your input...I have it working now that I understand the use of DECLS.

*big smile*


chi(Posted 2008) [#9]
your welcome ;)