?? dxerr.c
字號:
/////////////////////////////////////////////////////////////////////////////////////
// DirectX Includes...
/////////////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <ddraw.h>
#include <dinput.h>
#include <dsound.h>
void WriteDebug(char *);
void DS_Error( HRESULT hresult, char *msg )
{
char msgtext[128];
char errmsg[128];
switch(hresult)
{
case DS_OK:
strcpy(errmsg,"The request completed successfully.");
break;
case DSERR_ALLOCATED:
strcpy(errmsg,"The request failed because resources, such as a priority level, were already in use by another caller.");
break;
case DSERR_ALREADYINITIALIZED:
strcpy(errmsg,"The object is already initialized.");
break;
case DSERR_BADFORMAT:
strcpy(errmsg,"The specified wave format is not supported.");
break;
case DSERR_BUFFERLOST:
strcpy(errmsg,"The buffer memory has been lost and must be restored.");
break;
case DSERR_CONTROLUNAVAIL:
strcpy(errmsg,"The control (volume, pan, and so forth) requested by the caller is not available.");
break;
case DSERR_GENERIC:
strcpy(errmsg,"An undetermined error occurred inside the DirectSound subsystem.");
break;
case DSERR_INVALIDCALL:
strcpy(errmsg,"This function is not valid for the current state of this object.");
break;
case DSERR_INVALIDPARAM:
strcpy(errmsg,"An invalid parameter was passed to the returning function.");
break;
case DSERR_NOAGGREGATION:
strcpy(errmsg,"The object does not support aggregation.");
break;
case DSERR_NODRIVER:
strcpy(errmsg,"No sound driver is available for use.");
break;
case DSERR_OTHERAPPHASPRIO:
strcpy(errmsg,"This value is obsolete and is not used.");
break;
case DSERR_OUTOFMEMORY:
strcpy(errmsg,"The DirectSound subsystem could not allocate sufficient memory to complete the caller's request.");
break;
case DSERR_PRIOLEVELNEEDED:
strcpy(errmsg,"The caller does not have the priority level required for the function to succeed.");
break;
case DSERR_UNINITIALIZED:
strcpy(errmsg,"The IDirectSound::Initialize method has not been called or has not been called successfully before other methods were called.");
break;
case DSERR_UNSUPPORTED:
strcpy(errmsg,"The function called is not supported at this time.");
break;
default:
sprintf(errmsg,"Unknown Error Code: %04X", hresult);
strcpy(errmsg, msgtext);
break;
}
sprintf(msgtext, "DSERR: %s\n", errmsg);
WriteDebug( msgtext );
sprintf(msgtext, "%s FAILED\n", msg);
WriteDebug( msgtext );
}
void DD_Error( HRESULT hresult, char *msg )
{
static char msgtext[128];
static char errmsg[128];
switch(hresult)
{
case DD_OK:
strcpy(errmsg,"The request completed successfully.");
break;
case DDERR_ALREADYINITIALIZED:
strcpy(errmsg,"The object has already been initialized.");
break;
case DDERR_BLTFASTCANTCLIP:
strcpy(errmsg,"A DirectDrawClipper object is attached to a source surface that has passed into a call to the IDirectDrawSurface2::BltFast method.");
break;
case DDERR_CANNOTATTACHSURFACE:
strcpy(errmsg,"A surface cannot be attached to another requested surface.");
break;
case DDERR_CANNOTDETACHSURFACE:
strcpy(errmsg,"A surface cannot be detached from another requested surface.");
break;
case DDERR_CANTCREATEDC:
strcpy(errmsg,"Windows cannot create any more device contexts (DCs).");
break;
case DDERR_CANTDUPLICATE:
strcpy(errmsg,"Primary and 3D surfaces, or surfaces that are implicitly created, cannot be duplicated.");
break;
case DDERR_CANTLOCKSURFACE:
strcpy(errmsg,"Access to this surface is refused because an attempt was made to lock the primary surface without DCI support.");
break;
case DDERR_CANTPAGELOCK:
strcpy(errmsg,"An attempt to page lock a surface failed. Page lock will not work on a display-memory surface or an emulated primary surface.");
break;
case DDERR_CANTPAGEUNLOCK:
strcpy(errmsg,"An attempt to page unlock a surface failed. Page unlock will not work on a display-memory surface or an emulated primary surface.");
break;
case DDERR_CLIPPERISUSINGHWND:
strcpy(errmsg,"An attempt was made to set a clip list for a DirectDrawClipper object that is already monitoring a window handle.");
break;
case DDERR_COLORKEYNOTSET:
strcpy(errmsg,"No source color key is specified for this operation.");
break;
case DDERR_CURRENTLYNOTAVAIL:
strcpy(errmsg,"No support is currently available.");
break;
case DDERR_DCALREADYCREATED:
strcpy(errmsg,"A device context (DC) has already been returned for this surface. Only one DC can be retrieved for each surface.");
break;
case DDERR_DIRECTDRAWALREADYCREATED:
strcpy(errmsg,"A DirectDraw object representing this driver has already been created for this process.");
break;
case DDERR_EXCEPTION:
strcpy(errmsg,"An exception was encountered while performing the requested operation.");
break;
case DDERR_EXCLUSIVEMODEALREADYSET:
strcpy(errmsg,"An attempt was made to set the cooperative level when it was already set to exclusive.");
break;
case DDERR_GENERIC:
strcpy(errmsg,"There is an undefined error condition.");
break;
case DDERR_HEIGHTALIGN:
strcpy(errmsg,"The height of the provided rectangle is not a multiple of the required alignment.");
break;
case DDERR_HWNDALREADYSET:
strcpy(errmsg,"The DirectDraw cooperative level window handle has already been set. It cannot be reset while the process has surfaces or palettes created.");
break;
case DDERR_HWNDSUBCLASSED:
strcpy(errmsg,"DirectDraw is prevented from restoring state because the DirectDraw cooperative level window handle has been subclassed.");
break;
case DDERR_IMPLICITLYCREATED:
strcpy(errmsg,"The surface cannot be restored because it is an implicitly created surface.");
break;
case DDERR_INCOMPATIBLEPRIMARY:
strcpy(errmsg,"The primary surface creation request does not match with the existing primary surface.");
break;
case DDERR_INVALIDCAPS:
strcpy(errmsg,"One or more of the capability bits passed to the callback function are incorrect.");
break;
case DDERR_INVALIDCLIPLIST:
strcpy(errmsg,"DirectDraw does not support the provided clip list.");
break;
case DDERR_INVALIDDIRECTDRAWGUID:
strcpy(errmsg,"The globally unique identifier (GUID) passed to the DirectDrawCreate function is not a valid DirectDraw driver identifier.");
break;
case DDERR_INVALIDMODE:
strcpy(errmsg,"DirectDraw does not support the requested mode.");
break;
case DDERR_INVALIDOBJECT:
strcpy(errmsg,"DirectDraw received a pointer that was an invalid DirectDraw object.");
break;
case DDERR_INVALIDPARAMS:
strcpy(errmsg,"One or more of the parameters passed to the method are incorrect.");
break;
case DDERR_INVALIDPIXELFORMAT:
strcpy(errmsg,"The pixel format was invalid as specified.");
break;
case DDERR_INVALIDPOSITION:
strcpy(errmsg,"The position of the overlay on the destination is no longer legal.");
break;
case DDERR_INVALIDRECT:
strcpy(errmsg,"The provided rectangle was invalid.");
break;
case DDERR_INVALIDSURFACETYPE:
strcpy(errmsg,"The requested operation could not be performed because the surface was of the wrong type.");
break;
case DDERR_LOCKEDSURFACES:
strcpy(errmsg,"One or more surfaces are locked, causing the failure of the requested operation.");
break;
case DDERR_NO3D:
strcpy(errmsg,"No 3D hardware or emulation is present.");
break;
case DDERR_NOALPHAHW:
strcpy(errmsg,"No alpha acceleration hardware is present or available, causing the failure of the requested operation.");
break;
case DDERR_NOBLTHW:
strcpy(errmsg,"No blitter hardware is present.");
break;
case DDERR_NOCLIPLIST:
strcpy(errmsg,"No clip list is available.");
break;
case DDERR_NOCLIPPERATTACHED:
strcpy(errmsg,"No DirectDrawClipper object is attached to the surface object.");
break;
case DDERR_NOCOLORCONVHW:
strcpy(errmsg,"The operation cannot be carried out because no color-conversion hardware is present or available.");
break;
case DDERR_NOCOLORKEY:
strcpy(errmsg,"The surface does not currently have a color key.");
break;
case DDERR_NOCOLORKEYHW:
strcpy(errmsg,"The operation cannot be carried out because there is no hardware support for the destination color key.");
break;
case DDERR_NOCOOPERATIVELEVELSET:
strcpy(errmsg,"A create function is called without the IDirectDraw2::SetCooperativeLevel method being called.");
break;
case DDERR_NODC:
strcpy(errmsg,"No DC has ever been created for this surface.");
break;
case DDERR_NODDROPSHW:
strcpy(errmsg,"No DirectDraw raster operation (ROP) hardware is available.");
break;
case DDERR_NODIRECTDRAWHW:
strcpy(errmsg,"Hardware-only DirectDraw object creation is not possible; the driver does not support any hardware.");
break;
case DDERR_NODIRECTDRAWSUPPORT:
strcpy(errmsg,"DirectDraw support is not possible with the current display driver.");
break;
case DDERR_NOEMULATION:
strcpy(errmsg,"Software emulation is not available.");
break;
case DDERR_NOEXCLUSIVEMODE:
strcpy(errmsg,"The operation requires the application to have exclusive mode, but the application does not have exclusive mode.");
break;
case DDERR_NOFLIPHW:
strcpy(errmsg,"Flipping visible surfaces is not supported.");
break;
case DDERR_NOGDI:
strcpy(errmsg,"No GDI is present.");
break;
case DDERR_NOHWND:
strcpy(errmsg,"Clipper notification requires a window handle, or no window handle has been previously set as the cooperative level window handle.");
break;
case DDERR_NOMIPMAPHW:
strcpy(errmsg,"The operation cannot be carried out because no mipmap texture mapping hardware is present or available.");
break;
case DDERR_NOMIRRORHW:
strcpy(errmsg,"The operation cannot be carried out because no mirroring hardware is present or available.");
break;
case DDERR_NOOVERLAYDEST:
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -