Stop application from suspending

BlitzMax Forums/MaxGUI Module/Stop application from suspending

Ked(Posted 2008) [#1]
Is it possible to stop the application from suspending when you use HideGadget(windowhandle:TGadget)?

Thanks,


plash(Posted 2008) [#2]
I'm assuming your using a main loop that waits for an event, if you are you could use event hooks or a timeout on your waitevent instead.


Ked(Posted 2008) [#3]
How would I use a timeout on my waitevent?


plash(Posted 2008) [#4]
That's odd, I remember an optional parameter in the waitevent function to timeout. I suppose your only option would be hooks then.

EDIT: You could just create a dummy timer and whenever the timer ticks it will get out of waitevent, that would also allow you to check EVENT_TIMERTICK to tell when your waitevent "timed out".
CreateTimer(20) '20hz



Ked(Posted 2008) [#5]
Yeah, the optional parameter is in the Blitz+'s WaitEvent command but not BlitzMax's.

How would I use hooks? I haven't used them before.\

EDIT: Will that timer sample help with stopping the application from suspending?


plash(Posted 2008) [#6]
Yes, it will.
SuperStrict

Framework brl.win32maxgui
Import brl.timer
Import brl.eventqueue

Global Wnd_Main:TGadget = CreateWindow("My Window", 40, 40, 320, 240, Desktop(), WINDOW_TITLEBAR)
	HideGadget Wnd_Main

Global tm_timeout:TTimer = CreateTimer(20)
Repeat
  WaitEvent()
	Print CurrentEvent.ToString()
	
	Select EventID()
		Case EVENT_TIMERTICK
			Select EventSource()
				Case tm_timeout
					Print "The timeout timer has ticked!"
					
			End Select
			
		Case EVENT_WINDOWCLOSE
			End
			
	End Select
	
Forever

Notice the log will show 'AppSuspend: data=0, mods=0, x=0, y=0, extra=""', yet you will keep getting event messages.


Ked(Posted 2008) [#7]
Ok, thanks! I'll try this out.