AppSuspended() and full screen.

BlitzMax Forums/BlitzMax Programming/AppSuspended() and full screen.

Richard Betson(Posted 2013) [#1]
Hi,

Is there a workaround for using AppSuspended() while in full screen? Currently AppSuspended() only works if an app is in windowed mode. If the app is full screen mode and you alt+tab it does not work (fails to report app is App suspended).

Thanks,
- Rich -


Richard Betson(Posted 2013) [#2]
I guess I could scan the key input..

Edit - That's not going to workout.


xlsior(Posted 2013) [#3]
I'm assuming there should be a way to check whether or not your app has the focus?


TomToad(Posted 2013) [#4]
Try GetFocus() and GetActiveWindow()
Graphics 800,600,32

Local hwnd:Int = GetFocus()
Local PausedFrameCount:Int = 0

While Not KeyHit(Key_ESCAPE)
	Cls
	Local test:Int = GetActiveWindow()
	If test <> hwnd
		DrawText "Paused",10,10
		PausedFrameCount :+ 1
		DrawText "PausedFrameCount = "+PausedFrameCount,10,30
	Else
		DrawText "App is running",10,10
		DrawText "PausedFrameCount = "+PausedFrameCount,10,30
	End If
	Flip
Wend



Richard Betson(Posted 2013) [#5]
Hi,

@TomToad

I will give it a try.

Where are these commands from or what module are they in? I'm not able to find them in the docs.

I have to avoid using MaxGUI. In Linux MaxGUI causes problems in my application.

Thanks,


TomToad(Posted 2013) [#6]
It is in pub.mod/win32.mod/user32.bmx. It is not in the docs as it is one of BlitzMax's internal commands and is not cross platform. It is Windows only, not sure what the MacOS and Linux equivalents are.

Edit: Actually, you can still poll events even without MaxGUI. So the standard way of checking if the app loses focus still works.




Richard Betson(Posted 2013) [#7]
Right on,

That looks like it will work and is compatible across platforms. I'll give it a try and let you know.

Thanks,
- Rich -


Kryzon(Posted 2013) [#8]
The EVENT_APPSUSPEND and the AppSuspended() function both supply information taken from the same place. So if one works, so should the other.

There is, however, a commented 'case' in the function bbSystemEmitOSEvent() in BRL.mod\system.mod\system.win32.c.
It's in line 192, and starts like this:
	/*
	case WM_ACTIVATEAPP:
		//
		// WM_ACTIVATEAPP appears to be broken.
		//
		// Clicking on taskbar button to minimize an app appears to confuse poor old windows.
		//
		// So, we'll use the WM_ACTIVATE code above courtesy of Seb...
		//
		[...]
	*/
It has a couple more lines. I don't know if this is the cause of your problem, but I would uncomment so it can work. To uncomment it, delete the /* and */ tags that encapsulate this block, save the file and go to Program -> Build Modules in the IDE so the module is rebuilt with this functionality active.
To rebuild modules you will need MinGW installed properly.

EDIT: Also, make sure you have the latest version of BlitzMax.