Stop application from suspending
BlitzMax Forums/MaxGUI Module/Stop application from suspending
| ||
| Is it possible to stop the application from suspending when you use HideGadget(windowhandle:TGadget)? Thanks, |
| ||
| 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. |
| ||
| How would I use a timeout on my waitevent? |
| ||
| 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 |
| ||
| 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? |
| ||
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
ForeverNotice the log will show 'AppSuspend: data=0, mods=0, x=0, y=0, extra=""', yet you will keep getting event messages. |
| ||
| Ok, thanks! I'll try this out. |