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.

Dark GDK / The Dark GDK Error Handler

Author
Message
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 31st Jan 2010 17:22 Edited at: 31st Jan 2010 17:24
There is a serious bug in DarkGDK causing the first variable in your program to be modified whenever there is an error.

Also, there is currently no good way to detect when errors occured.

For these reasons I made these error functions, which let you handle errors however you want!

In addition, they prevent GDK from modifying the first variable in your program! (The error code output is redirected to a specially made variable)

GDKError.h


GDKError.cpp


Just add those two files to your project, and then include "GDKError.h" from your main source file.

At the very start of your program, call "SetErrorHandler" with a function to handle errors.

Here is an example program which catches and displays errors in the same way as DBPro (except that it doesn't end the program):



As you can see, the "dbLoadImage" command will fail because the image does not exist. This will cause the "ErrorHandler" function to be called, which then displays the following error message:

Quote: "
---------------------------
Error
---------------------------
Runtime Error 506 - Could not load image

CWD:c:\Documents and Settings\John Smith\My Documents\Visual Studio 2008\Projects\Dark GDK - Game1\Dark GDK - Game1
LOAD IMAGE None.png,1
---------------------------
OK
---------------------------
"


Enjoy

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 31st Jan 2010 18:32
This is the kind of detail I wish I had time to dig into with Windows programming.

Thanks for the code. Although I haven't had time to spend with game programming in a while I'm sure this will come in handy in the future.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 31st Jan 2010 18:38
Hehe, it took some serious reverse engineering to get it to work!

Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 2nd Feb 2010 22:46
Diggsey.... I love you.... (dont think my wife wants to know that)

Very good work ....

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 3rd Feb 2010 08:04
Quote: "There is a serious bug in DarkGDK causing the first variable in your program to be modified whenever there is an error."


Wow... and this bug has existed since release, right?
Freedom Fighters
15
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 3rd Feb 2010 11:03
nice. this is going to be a big help if it worked. i got and error when compiling.



i did what you said so its not making much sense to me.

Problem Solution That Never Fails: "Build A Bridge And Get Over It"
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 3rd Feb 2010 17:58 Edited at: 3rd Feb 2010 18:00
You need to make sure that you include "DarkGDK.h" from at least one .cpp file in your project.

If you still have problems, remove the line which assigns a value to "rte2"

Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 4th Feb 2010 11:15
hmmm im sorry to dissapoint you but it doesnt work for me :/ it does compile and everything goes well... i try to load an image that does not exist and i dont see any warning... i get various crashes and the handler doesnt report a thing... what can it be ??

hi
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 4th Feb 2010 17:38
Make sure you have the latest version of DarkGDK. Apart from that I can't think what would cause the crash.

Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 4th Feb 2010 23:28
hmm ok if it works for you i might have something wrong somewhere...

hi

Login to post a reply

Server time is: 2024-11-20 05:26:21
Your offset time is: 2024-11-20 05:26:21