为什么我每次调用完lpsurface->Lock(NULL,&DDdesc,DDLOCK_WAIT,NULL)总是返回失败!=DD_OK
//将表面lpsurface上的某矩形块拷贝到[buf,width,height]的DstX,DstY里面
void CopySurfaceRect(LPDIRECTDRAWSURFACE lpsurface,int SrcX,int SrcY,int SrcW,int SrcH,
LPBYTE buf,int width,int height,int DstX,int DstY)
{ LONG pitch;
  LPBYTE localStart,lastRow;
  LPBYTE DstStart;
  int x,y;
  DDSURFACEDESC DDdesc;
  int Lc;
  if((Lc=lpsurface->Lock(NULL,&DDdesc,DDLOCK_WAIT,NULL))!=DD_OK)
  { return;//每次总在这里返回了,郁闷!
  }
   pitch=DDdesc.lPitch;
//   if(SrcW==0||SrcH==0){SrcW=DDdesc.dwWidth;SrcH=DDdesc.dwHeight;}
//   bn(8);
   localStart=(LPBYTE)DDdesc.lpSurface+SrcY*pitch+SrcX*3;
   for(y=0;y<SrcH;y++)
   { lastRow=localStart;
     DstStart=buf+((DstY+y)*width+DstX)*3;
 for(x=0;x<SrcW;x++)
 { memcpy(DstStart,localStart,3);
   //*DstStart=255;*(DstStart+1)=255;*(DstStart+2)=0;
   DstStart+=3;localStart+=3;
 }
     localStart=lastRow+pitch;
   }
   //getPitch(lpsurface,&pitch);//根据当前颜色深度进行调整
   //LPDIRECTDRAWSURFACE src=lpsurface;
   //src+=y*pitch+x;//获取象素对应地址?
   //color=*src;
  lpsurface->Unlock(NULL);
}