Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Ctrl+Alt+Del on windows 7 sp1 causes application to crash/not recover properly

Author
Message
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 6th Jun 2011 11:07
Hey guys, working on my game and decided to test the stability of it. When I switch away, minimize, use alt+tab, the game WILL recover exactly the way it was before losing focus, I have programmed it to do so using the SCREEN INVALID() command and IanM's HAS FOCUS() command. However, when I do a ctrl+alt+del, if the program is in focus, it won't go back to the way it was (font has been resized to the default and all sprites/images have been drawn) and if the progam is minmized it will crash with "image number illegal at line xxx". I have search through previous threads on this subject but each one I found was pre-windows 7.

I'm running windows 7 32 bit, 4gb ram ddr3, intel i7 820qm processer.

When I hit ctrl+alt+del (windows 7 users will probably know this), it doesn't bring up the task manager, it goes to something similar to a log on screen but has different options like "Start windows task manager", "lock this computer" etc. The crash or part-recovery occurs when I hit the "Cancel" button.

Any help is greatly appreciated

A clever person solves a problem, a wise person avoids it - Albert Einstein
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 6th Jun 2011 11:40
As far as I'm aware there's no real solution to this other than simply not running in FSEX mode.



Support a charitable indie game project!
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 6th Jun 2011 12:30
Thanks for the reply, just tried it and although it doesn't crash, it still restores incorrectly, kind of like everything has been reset and all sprites are shown even though some are supposed to be hidden, text is resized as well.

A clever person solves a problem, a wise person avoids it - Albert Einstein
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 6th Jun 2011 13:48
It's because whenever windows changes resolution (Which it does when ever you ctrl-alt-del, or switch from one FullScreen Exclusive app to the desktop), DirectX flushes the graphics buffer, meaning any graphical media you have loaded, becomes unloaded.

The simplest way round this is to simply check before using media and if it doesn't exist then call the load media routine again.

It's a right pain in the bum tbh, but its a windows problem, and all programmers need to work round it, not just DBP users.

Hope that helps.

Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 6th Jun 2011 14:35
Problem solved. I was on the right track with reloading media etc but my recovery function wasn't refined enough. Here goes my lengthy explanation

Factors causing it to crash were illegal image numbers. This was because when animating some of my sprites, I would change there image number. This became a problem when I used the same variable to reload my images. I'm assuming this resulted in duplicate image numbers which is what caused the crash. My recommendation to anyone developing a project is to store all of your image numbers in excel or something like that, saved my program today

The problem which caused a different recovery, e.g different text sizes and sprites appearing when they shouldn't was due to the fact that I relied on other functions too much. E.g if I have func1() and func2() and set the text to bold in func1() and then went straight to func2(), the text would be bold in func2(). But, if I ctrl+alt+del in func2() the text gets reset. Solution, set the text to bold in func1() and func2(). Same thing with hiding and showing sprites.

Well that's my solution , stupid and ignorant mistakes I know but atleast I gaind some very valuable experience doing this.

Thank you =Prof= for the explanation

A clever person solves a problem, a wise person avoids it - Albert Einstein
Mistrel
Retired Moderator
20
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 7th Jun 2011 20:03 Edited at: 7th Jun 2011 20:04

Login to post a reply

Server time is: 2026-07-10 17:39:10
Your offset time is: 2026-07-10 17:39:10