1 
2 #define GetCode(X) printf("%s\n", DDErrorString(X));
3 
DDErrorString(HRESULT hResult)4 const CHAR* DDErrorString (HRESULT hResult)
5 {
6 	switch (hResult)
7 	{
8 		case DD_OK:                              return "DD_OK";
9 		case DDERR_ALREADYINITIALIZED:           return "DDERR_ALREADYINITIALIZED";
10 		case DDERR_CANNOTATTACHSURFACE:          return "DDERR_CANNOTATTACHSURFACE";
11 		case DDERR_CANNOTDETACHSURFACE:          return "DDERR_CANNOTDETACHSURFACE";
12 		case DDERR_CURRENTLYNOTAVAIL:            return "DDERR_CURRENTLYNOTAVAIL";
13 		case DDERR_EXCEPTION:                    return "DDERR_EXCEPTION";
14 		case DDERR_GENERIC:                      return "DDERR_GENERIC";
15 		case DDERR_HEIGHTALIGN:                  return "DDERR_HEIGHTALIGN";
16 		case DDERR_INCOMPATIBLEPRIMARY:          return "DDERR_INCOMPATIBLEPRIMARY";
17 		case DDERR_INVALIDCAPS:                  return "DDERR_INVALIDCAPS";
18 		case DDERR_INVALIDCLIPLIST:              return "DDERR_INVALIDCLIPLIST";
19 		case DDERR_INVALIDMODE:                  return "DDERR_INVALIDMODE";
20 		case DDERR_INVALIDOBJECT:                return "DDERR_INVALIDOBJECT";
21 		case DDERR_INVALIDPARAMS:                return "DDERR_INVALIDPARAMS";
22 		case DDERR_INVALIDPIXELFORMAT:           return "DDERR_INVALIDPIXELFORMAT";
23 		case DDERR_INVALIDRECT:                  return "DDERR_INVALIDRECT";
24 		case DDERR_LOCKEDSURFACES:               return "DDERR_LOCKEDSURFACES";
25 		case DDERR_NO3D:                         return "DDERR_NO3D";
26 		case DDERR_NOALPHAHW:                    return "DDERR_NOALPHAHW";
27 		case DDERR_NOCLIPLIST:                   return "DDERR_NOCLIPLIST";
28 		case DDERR_NOCOLORCONVHW:                return "DDERR_NOCOLORCONVHW";
29 		case DDERR_NOCOOPERATIVELEVELSET:        return "DDERR_NOCOOPERATIVELEVELSET";
30 		case DDERR_NOCOLORKEY:                   return "DDERR_NOCOLORKEY";
31 		case DDERR_NOCOLORKEYHW:                 return "DDERR_NOCOLORKEYHW";
32 		case DDERR_NODIRECTDRAWSUPPORT:          return "DDERR_NODIRECTDRAWSUPPORT";
33 		case DDERR_NOEXCLUSIVEMODE:              return "DDERR_NOEXCLUSIVEMODE";
34 		case DDERR_NOFLIPHW:                     return "DDERR_NOFLIPHW";
35 		case DDERR_NOGDI:                        return "DDERR_NOGDI";
36 		case DDERR_NOMIRRORHW:                   return "DDERR_NOMIRRORHW";
37 		case DDERR_NOTFOUND:                     return "DDERR_NOTFOUND";
38 		case DDERR_NOOVERLAYHW:                  return "DDERR_NOOVERLAYHW";
39 		case DDERR_NORASTEROPHW:                 return "DDERR_NORASTEROPHW";
40 		case DDERR_NOROTATIONHW:                 return "DDERR_NOROTATIONHW";
41 		case DDERR_NOSTRETCHHW:                  return "DDERR_NOSTRETCHHW";
42 		case DDERR_NOT4BITCOLOR:                 return "DDERR_NOT4BITCOLOR";
43 		case DDERR_NOT4BITCOLORINDEX:            return "DDERR_NOT4BITCOLORINDEX";
44 		case DDERR_NOT8BITCOLOR:                 return "DDERR_NOT8BITCOLOR";
45 		case DDERR_NOTEXTUREHW:                  return "DDERR_NOTEXTUREHW";
46 		case DDERR_NOVSYNCHW:                    return "DDERR_NOVSYNCHW";
47 		case DDERR_NOZBUFFERHW:                  return "DDERR_NOZBUFFERHW";
48 		case DDERR_NOZOVERLAYHW:                 return "DDERR_NOZOVERLAYHW";
49 		case DDERR_OUTOFCAPS:                    return "DDERR_OUTOFCAPS";
50 		case DDERR_OUTOFMEMORY:                  return "DDERR_OUTOFMEMORY";
51 		case DDERR_OUTOFVIDEOMEMORY:             return "DDERR_OUTOFVIDEOMEMORY";
52 		case DDERR_OVERLAYCANTCLIP:              return "DDERR_OVERLAYCANTCLIP";
53 		case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: return "DDERR_OVERLAYCOLORKEYONLYONEACTIVE";
54 		case DDERR_PALETTEBUSY:                  return "DDERR_PALETTEBUSY";
55 		case DDERR_COLORKEYNOTSET:               return "DDERR_COLORKEYNOTSET";
56 		case DDERR_SURFACEALREADYATTACHED:       return "DDERR_SURFACEALREADYATTACHED";
57 		case DDERR_SURFACEALREADYDEPENDENT:      return "DDERR_SURFACEALREADYDEPENDENT";
58 		case DDERR_SURFACEBUSY:                  return "DDERR_SURFACEBUSY";
59 		case DDERR_CANTLOCKSURFACE:              return "DDERR_CANTLOCKSURFACE";
60 		case DDERR_SURFACEISOBSCURED:            return "DDERR_SURFACEISOBSCURED";
61 		case DDERR_SURFACELOST:                  return "DDERR_SURFACELOST";
62 		case DDERR_SURFACENOTATTACHED:           return "DDERR_SURFACENOTATTACHED";
63 		case DDERR_TOOBIGHEIGHT:                 return "DDERR_TOOBIGHEIGHT";
64 		case DDERR_TOOBIGSIZE:                   return "DDERR_TOOBIGSIZE";
65 		case DDERR_TOOBIGWIDTH:                  return "DDERR_TOOBIGWIDTH";
66 		case DDERR_UNSUPPORTED:                  return "DDERR_UNSUPPORTED";
67 		case DDERR_UNSUPPORTEDFORMAT:            return "DDERR_UNSUPPORTEDFORMAT";
68 		case DDERR_UNSUPPORTEDMASK:              return "DDERR_UNSUPPORTEDMASK";
69 		case DDERR_VERTICALBLANKINPROGRESS:      return "DDERR_VERTICALBLANKINPROGRESS";
70 		case DDERR_WASSTILLDRAWING:              return "DDERR_WASSTILLDRAWING";
71 		case DDERR_XALIGN:                       return "DDERR_XALIGN";
72 		case DDERR_INVALIDDIRECTDRAWGUID:        return "DDERR_INVALIDDIRECTDRAWGUID";
73 		case DDERR_DIRECTDRAWALREADYCREATED:     return "DDERR_DIRECTDRAWALREADYCREATED";
74 		case DDERR_NODIRECTDRAWHW:               return "DDERR_NODIRECTDRAWHW";
75 		case DDERR_PRIMARYSURFACEALREADYEXISTS:  return "DDERR_PRIMARYSURFACEALREADYEXISTS";
76 		case DDERR_NOEMULATION:                  return "DDERR_NOEMULATION";
77 		case DDERR_REGIONTOOSMALL:               return "DDERR_REGIONTOOSMALL";
78 		case DDERR_CLIPPERISUSINGHWND:           return "DDERR_CLIPPERISUSINGHWND";
79 		case DDERR_NOCLIPPERATTACHED:            return "DDERR_NOCLIPPERATTACHED";
80 		case DDERR_NOHWND:                       return "DDERR_NOHWND";
81 		case DDERR_HWNDSUBCLASSED:               return "DDERR_HWNDSUBCLASSED";
82 		case DDERR_HWNDALREADYSET:               return "DDERR_HWNDALREADYSET";
83 		case DDERR_NOPALETTEATTACHED:            return "DDERR_NOPALETTEATTACHED";
84 		case DDERR_NOPALETTEHW:                  return "DDERR_NOPALETTEHW";
85 		case DDERR_BLTFASTCANTCLIP:              return "DDERR_BLTFASTCANTCLIP";
86 		case DDERR_NOBLTHW:                      return "DDERR_NOBLTHW";
87 		case DDERR_NODDROPSHW:                   return "DDERR_NODDROPSHW";
88 		case DDERR_OVERLAYNOTVISIBLE:            return "DDERR_OVERLAYNOTVISIBLE";
89 		case DDERR_NOOVERLAYDEST:                return "DDERR_NOOVERLAYDEST";
90 		case DDERR_INVALIDPOSITION:              return "DDERR_INVALIDPOSITION";
91 		case DDERR_NOTAOVERLAYSURFACE:           return "DDERR_NOTAOVERLAYSURFACE";
92 		case DDERR_EXCLUSIVEMODEALREADYSET:      return "DDERR_EXCLUSIVEMODEALREADYSET";
93 		case DDERR_NOTFLIPPABLE:                 return "DDERR_NOTFLIPPABLE";
94 		case DDERR_CANTDUPLICATE:                return "DDERR_CANTDUPLICATE";
95 		case DDERR_NOTLOCKED:                    return "DDERR_NOTLOCKED";
96 		case DDERR_CANTCREATEDC:                 return "DDERR_CANTCREATEDC";
97 		case DDERR_NODC:                         return "DDERR_NODC";
98 		case DDERR_WRONGMODE:                    return "DDERR_WRONGMODE";
99 		case DDERR_IMPLICITLYCREATED:            return "DDERR_IMPLICITLYCREATED";
100 		case DDERR_NOTPALETTIZED:                return "DDERR_NOTPALETTIZED";
101 		case DDERR_UNSUPPORTEDMODE:              return "DDERR_UNSUPPORTEDMODE";
102 		case DDERR_NOMIPMAPHW:                   return "DDERR_NOMIPMAPHW";
103 		case DDERR_INVALIDSURFACETYPE:           return "DDERR_INVALIDSURFACETYPE";
104 		case DDERR_DCALREADYCREATED:             return "DDERR_DCALREADYCREATED";
105 		case DDERR_CANTPAGELOCK:                 return "DDERR_CANTPAGELOCK";
106 		case DDERR_CANTPAGEUNLOCK:               return "DDERR_CANTPAGEUNLOCK";
107 		case DDERR_NOTPAGELOCKED:                return "DDERR_NOTPAGELOCKED";
108 		case DDERR_NOTINITIALIZED:               return "DDERR_NOTINITIALIZED";
109 	}
110 	return "Unknown Error";
111 }
112