//******************************************************************
//图片从透明到不透明渐进显示
//******************************************************************
void Ddraw_AlphaBlend(HWND hWnd,DWORD PicID)
{
BLENDFUNCTION blendfuction;
RECT rect = {0,0,480,272};
BYTE CurrentAlpha = 150;
blendfuction.BlendOp = AC_SRC_OVER;
blendfuction.BlendFlags = 0;
blendfuction.AlphaFormat = 0;
HDC hdcDest,hdcSrc;
HBITMAP hBmp;
hdcDest = GetDC(hWnd);
hdcSrc = CreateCompatibleDC(hdcDest);
hBmp = LoadBitmap(hInst,MAKEINTRESOURCE(PicID));
HGDIOBJ hOldSel = SelectObject(hdcSrc,hBmp);
BITMAP bmp;
GetObject(hBmp,sizeof(BITMAP),&bmp);
blendfuction.SourceConstantAlpha = CurrentAlpha; //当前透明度 0~255
if(!AlphaBlend(hdcDest,129,188,bmp.bmWidth, bmp.bmHeight,hdcSrc,0,0,bmp.bmWidth,bmp.bmHeight,blendfuction))
{
MessageBox(hWnd,TEXT("Error"),TEXT("err"),MB_OK);
}
SelectObject(hdcSrc,hOldSel);
DeleteObject(hdcSrc);
DeleteDC(hdcDest);
}