View Full Version : [D3D] how to show your own error-dialog

24-04-2006, 03:48 PM
Hi everyone. 8)

I want to make a good error-handling system for my engine. If an error occures, some kind of dialog box must appear and show some information about what went wrong. :)

The problem is that i dont know how to show a dialog box when i'am in a full-screen D3D app. Until now i used Messagebox to achieve this but i want more. I want my dialogbox to have 'abort', 'ignore' and 'detail' buttons.

A simple Messagebox doesn't have these things so i have to create some kind of dialog myself. I also tried Showmessage but it didn't show up and the application froze. :x :twisted:

Does anyone know how to create a dialogbox with you own buttons and functionality wich is able to showup in a D3D application??

Thanx in advance. ;)

24-04-2006, 05:01 PM
Personally I would write the engine so that it handles expected errors without informing the user, but any error that happens that I'm not expecting will result in the application exiting and then showing some kind of error dialog/report. It all depends on what kind of errors you are talking about.

For instance access violations usually mean something has gone really wrong, so I would exit. But an error connecting to a remote server would not cause the applicaton to exit but handle the error in some way (not always with a dialog).

Showmessage will not work in a full screen application as the dialog is displayed behind the fullscreen window (one of the reasons why you can't debug a full screen app unless you have two monitors). You would need to write your own UI to handle that I think.

24-04-2006, 05:37 PM
The whole errorsystem will be mostly for debugging. When i publish the game, most common errors like unsupported displaymode, d3dxx.dll not found etc will be handled differently (with a proper explanation) s?? that the user understands them. 8)

I also like to have an 'ignore' option for non-fatal errors. If a nonfatal error occures i cannot simply exit the game.

is there some kind of 'flip back to the GDI' function available. Then i can let the engine show the error in the GDI and return to the game if Ignore is selected.

Messagebox proofs that its possible to show a message dialog in a d3d app. Anyone knows a way to make my own errordialog that can do the same thing?? :razz:

//edit: I'am only talking about the realy wrong errors like AV's, Overflows and other errors that occure because of my own mistakes. :)

24-04-2006, 06:11 PM
If you are only talking about really wrong errors and debug mode, then I would write those to a error log file and exit the app, the chances are you will need to change the app at some point after than anyway. :wink:

24-04-2006, 10:03 PM
in D3D9 it's called SetDialogBoxMode. But it's has some restrictions:

If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be D3DERR_INVALIDCALL unless all of the following are true.

The application specified a back buffer format compatible with GDI, in other words, one of D3DFMT_X1R5G5B5, D3DFMT_R5G6B5, or D3DFMT_X8R8G8B8.
The application specified no multisampling.
The application specified D3DSWAPEFFECT_DISCARD.
The application did not specify D3DCREATE_ADAPTERGROUP_DEVICE.
The application is not between BeginScene and EndScene.

25-04-2006, 06:38 AM
Owh its a pitty i use DX8.1. :o :cry:

If its not possible i will stick to Messagebox and write more detailed info to a log file. :)

But how is it possible that Messagebox actualy shows up. Whats the main difference between messagebox and all those others like showmessage, messagedlg, etc... ?? :?