Click here to Skip to main content
12,701,133 members (26,835 online)
Click here to Skip to main content
Add your own
alternative version


44 bookmarked

Using the AlphaBlend function

, 1 Feb 2000
Rate this:
Please Sign up or sign in to vote.
A sample application that uses the AlphaBlend function to produce a transparent splash screen
  • Download source files - 35 Kb
  • Sample Image - alphablend.gif

    <!-- 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;
    • 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.


    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    Wooseok Seo
    Software Developer (Senior)
    Korea (Republic of) Korea (Republic of)
    Woo Seok Seo have been a Microsoft MVP for 7 years and have translated several books into Korean. Author of C# Programming for Beginner (DevPress, 2001), he is interested in Debugging techniques and .NET technology. Get in touch with Woo Seok Seo at

    You may also be interested in...


    Comments and Discussions

    QuestionGotcha with 64-bit OS and AlphaBlend Pin
    Snuff Daddy12-Jun-15 13:33
    memberSnuff Daddy12-Jun-15 13:33 
    QuestionAlphaBlend mode using Borland C++ 5.0 Pin
    Member 1091480330-Jun-14 9:33
    memberMember 1091480330-Jun-14 9:33 
    GeneralMy vote of 3 Pin
    Mahdi Nejadsahebi30-Apr-11 22:24
    groupMahdi Nejadsahebi30-Apr-11 22:24 
    GeneralMy vote of 2 Pin
    Member 3186846-Jan-10 1:41
    memberMember 3186846-Jan-10 1:41 
    QuestionAlphaBlend draws over the existing backgruound making it darker. gradually losing transaprency Pin
    VC++Maniac20-Apr-09 22:15
    memberVC++Maniac20-Apr-09 22:15 
    AnswerRe: AlphaBlend draws over the existing backgruound making it darker. gradually losing transaprency Pin
    Snuff Daddy12-Jun-15 13:41
    memberSnuff Daddy12-Jun-15 13:41 
    GeneralAbout OnPaint with the AlphaBlend(); [modified] Pin
    Ted Lin16-Aug-07 23:12
    memberTed Lin16-Aug-07 23:12 
    GeneralAlphaBlend wrong formula ?! Pin
    Octopod23-Sep-06 11:17
    memberOctopod23-Sep-06 11:17 
    GeneralRe: AlphaBlend wrong formula ?! Pin
    Octopod23-Sep-06 11:50
    memberOctopod23-Sep-06 11:50 
    GeneralThank you Pin
    Nick Z.23-May-05 11:41
    memberNick Z.23-May-05 11:41 
    GeneralProblem with AlphaBlend Pin
    acidutzu24-Mar-05 0:13
    memberacidutzu24-Mar-05 0:13 
    GeneralRe: Problem with AlphaBlend Pin
    jgarnett27-Oct-05 16:59
    memberjgarnett27-Oct-05 16:59 
    GeneralRe: Problem with AlphaBlend Pin
    Snuff Daddy12-Jun-15 13:31
    memberSnuff Daddy12-Jun-15 13:31 
    GeneralQuestion Pin
    one_eddie1-Oct-04 12:40
    memberone_eddie1-Oct-04 12:40 
    GeneralGreat stuff! Pin
    JustDan24-Jan-04 18:36
    memberJustDan24-Jan-04 18:36 
    GeneralRe: Great stuff! Pin
    anothermxw4-Apr-04 20:08
    memberanothermxw4-Apr-04 20:08 
    GeneralRe: Great stuff! Pin
    Anonymous5-Apr-04 15:18
    sussAnonymous5-Apr-04 15:18 
    GeneralNo with Dialog Pin
    mojster17-May-03 6:42
    membermojster17-May-03 6:42 
    GeneralAlgorithm Code Pin
    Jack Rabbit27-Feb-03 18:34
    memberJack Rabbit27-Feb-03 18:34 
    GeneralRe: Algorithm Code Pin
    Henry P.27-Feb-03 18:57
    memberHenry P.27-Feb-03 18:57 
    GeneralRe: Algorithm Code Pin
    Jack Rabbit28-Feb-03 20:38
    memberJack Rabbit28-Feb-03 20:38 
    GeneralRe: Algorithm Code Pin
    Anonymous3-Mar-03 7:27
    sussAnonymous3-Mar-03 7:27 
    GeneralRe: Algorithm Code Pin
    Jack Rabbit8-Mar-03 5:50
    memberJack Rabbit8-Mar-03 5:50 
    GeneralRe: Algorithm Code Pin
    Henry P.31-Mar-03 20:22
    memberHenry P.31-Mar-03 20:22 
    GeneralRe: Algorithm Code Pin
    B2kguga25-Feb-07 11:04
    memberB2kguga25-Feb-07 11:04 
    GeneralWin95/98/ME vs. WinNT/2000/XP Pin
    Henry P.27-Feb-03 17:57
    memberHenry P.27-Feb-03 17:57 
    GeneralRe: Win95/98/ME vs. WinNT/2000/XP Pin
    Christian Graus27-Feb-03 18:57
    memberChristian Graus27-Feb-03 18:57 
    GeneralRe: Win95/98/ME vs. WinNT/2000/XP Pin
    Henry P.3-Mar-03 10:21
    memberHenry P.3-Mar-03 10:21 
    GeneralRe: Win95/98/ME vs. WinNT/2000/XP Pin
    Christian Graus3-Mar-03 10:29
    memberChristian Graus3-Mar-03 10:29 
    QuestionHow fast is AlphaBlend Pin
    Henry P.26-Feb-03 10:38
    memberHenry P.26-Feb-03 10:38 
    Questionhow to edit & save a 32 bit HBITMAP? (vc6.0) Pin
    hexi9-Dec-02 23:13
    memberhexi9-Dec-02 23:13 
    GeneralAlphaBlend leaks Resources/Memory Pin
    cts26-Nov-02 13:13
    membercts26-Nov-02 13:13 
    GeneralRe: AlphaBlend leaks Resources/Memory Pin
    Henry P.26-Feb-03 10:39
    memberHenry P.26-Feb-03 10:39 
    GeneralRe: AlphaBlend leaks Resources/Memory Pin
    Danny J16-May-04 10:21
    memberDanny J16-May-04 10:21 
    GeneralUm... Pin
    Anonymous21-Oct-02 14:24
    sussAnonymous21-Oct-02 14:24 
    Generalit can't do anything for a subwindow(control) in a dialog Pin
    Anonymous27-Sep-02 17:33
    sussAnonymous27-Sep-02 17:33 
    GeneralCan't Fade-Out doing similar Pin
    Todd Jackson1-Aug-02 10:17
    sussTodd Jackson1-Aug-02 10:17 
    GeneralRe: Can't Fade-Out doing similar Pin
    Anonymous11-Aug-02 18:11
    sussAnonymous11-Aug-02 18:11 
    QuestionHow about moved window? Pin
    BtvnLue6-Nov-01 22:51
    memberBtvnLue6-Nov-01 22:51 
    GeneralNot quit 100% proof Pin
    Anonymous26-Oct-01 1:19
    memberAnonymous26-Oct-01 1:19 
    QuestionUsing this in ActiveX controls? Pin
    Daed10-Jul-01 0:52
    memberDaed10-Jul-01 0:52 
    QuestionWhy not simply use SetLayeredWindowAttributes? Pin
    Arnaud MEURET9-Jul-01 6:21
    memberArnaud MEURET9-Jul-01 6:21 
    AnswerRe: Why not simply use SetLayeredWindowAttributes? Pin
    Eric Lindsey21-Jul-01 6:22
    memberEric Lindsey21-Jul-01 6:22 
    GeneralRe: Why not simply use SetLayeredWindowAttributes? Pin
    Anonymous26-Oct-01 1:11
    memberAnonymous26-Oct-01 1:11 
    GeneralTRUE color image Pin
    Paolo1-May-01 23:15
    memberPaolo1-May-01 23:15 
    GeneralRe: TRUE color image Pin
    Arnaud MEURET9-Jul-01 6:18
    memberArnaud MEURET9-Jul-01 6:18 
    GeneralRe: TRUE color image Pin
    Eric Lindsey21-Jul-01 6:18
    memberEric Lindsey21-Jul-01 6:18 
    QuestionAny way to blend an entire form like win2000? Pin
    Johnathon28-Sep-00 13:47
    sussJohnathon28-Sep-00 13:47 
    AnswerRe: Any way to blend an entire form like win2000? Pin
    Eric Lindsey21-Jul-01 6:10
    memberEric Lindsey21-Jul-01 6:10 
    QuestionCode not using MFC? Pin
    Jon Boyce31-Aug-00 1:05
    sussJon Boyce31-Aug-00 1:05 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    | Advertise | Privacy | Terms of Use | Mobile
    Web02 | 2.8.170118.1 | Last Updated 2 Feb 2000
    Article Copyright 2000 by Wooseok Seo
    Everything else Copyright © CodeProject, 1999-2017
    Layout: fixed | fluid