/* * DDSetColorKey * set a color key for a surface, given a RGB. * if you pass CLR_INVALID as the color key, the pixel * in the upper-left corner will be used. */ HRESULT DDSetColorKey(LPDIRECTDRAWSURFACE pdds, COLORREF rgb) { DDCOLORKEY ddck; ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb); ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue; return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck); }