 by fzammetti » Mar 6, 2004 @ 5:03am
by fzammetti » Mar 6, 2004 @ 5:03am 
			
			Compare the result to the constants in GD.  For instance, you can generally do:
HRESULT hr;
hr = graphic.CreateSurface(GDSURFACE_SYSTEMMEMORY, pImageFile);
if (hr != GD_OK) {
  // Do some sort of error handling
}
You could do something as simple as:
if (hr == GDERR_BITMAPNOTFOUND) { // Pop error message }
if (hr == GDERR_INCOMPATIBLEPRIMARY { // Pop error message }
if (hr == GDERR_INVALIDBITMAP { // Pop error message }
if (hr == GDERR_INVALIDPARAMS { // Pop error message }
if (hr == GDERR_INVALIDSURFACETYPE { // Pop error message }
if (hr == GDERR_LOCKEDSURFACES { // Pop error message }
if (hr == GDERR_OUTOFMEMORY  { // Pop error message }
if (hr == GDERR_SURFACELOST  { // Pop error message }
Those are all the errors defined for this function to return.
Personally, I have a simple wrapper function that I call in place of CreateSurface that handles this so I don't have a bunch of repeated code.  I suspect everyone does a very similar thing too.
			...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"