Download source files - 35 Kb

<!-- Article Starts -->
Note: The code in this article is restricted to win98 and win2000
Do you want to cool splash window?. Do you think the general splash window is not good enough
for your app? Then this sample source is for you.
My semi-transparent splash window uses the AlphaBlend function. When I found this function, I was so surprised!
The function works just like BitBlt for bitmaps that have transparent or
semitransparent pixels. Here is the AlphaBlend function's syntax
BOOL AlphaBlend( HDC hdcDest,
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest,
HDC hdcSrc,
int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
BLENDFUNCTION blendFunction
);
The important parameter is last one, BLENDFUNCTION.
typedef struct _BLENDFUNCTION {
BYTE BlendOp;
BYTE BlendFlags;
BYTE SourceConstantAlpha;
BYTE AlphaFormat;
}BLENDFUNCTION;
- BlendOp must be
AC_SRC_OVER
- BlendFlags must be
0
- SourceConstantAlpha must be between 0 (transparent) and 255 (semi-transparent).
- AlphaFormat must be
AC_SRC_ALPHA
MSND states: The
SourceConstantaAlpha member of
BLENDFUNCTION specifies an alpha transparancy
value to be used on the entire source bitmap. The
SourceConstantAlpha
value is combined with any per-pixel alpha values. If you set
SourceConstantAlpha to 0, it is assumed that your image is transparent.
Set the
SourceConstantAlpha value to 255 (indicates that the image is
opaque) when you only want to use per-pixel alpha values.
See the sample application for a demonstration.
Just enjoy!!
Ajou University C.C. 4th member.