Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 821375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:37:47+00:00 2026-05-15T02:37:47+00:00

Is there a way I can determine if an HDC uses alpha channel? I

  • 0

Is there a way I can determine if an HDC uses alpha channel? I read Question 333559 and Question 685684, but their questions are about BITMAP. Apparently, some HDC has alpha channel (though they may not use it. Call this “Type 1”) while others do not (“Type 2”). I know this by doing the following:

Given a HDC,

  1. Create a compatible DC, and create a DIB section. Select the created HBITMAP into the compatible DC.

  2. BitBlt the source HDC to the compatible DC. Now examine the DIB section bits. For type 2 HDC, after every 3 bytes there is a byte always 0 (like 255 255 255 0); for type 1, these bytes are usualy 255 (like 250 240 230 255). To avoid false positive, I memset the bits to all 0x80 prior to the calls.

  3. Use GetDIBits directly on the source HDC, specify the HBITMAP as GetCurrentObject(hdc, OBJ_BITMAP). For both types of HDC, the 4th bytes are always 0.

  4. Change the DC bitmap by calling ExtTextOut. For type 2, ExtTextOut always set the 4th bytes to 0. For type 1, ExtTextOut always leave them untouched.

I also noticed that the source HDC that are created by APIs (CreateCompatibleDC(), BeginPaint() …) are always type 2. Type 1 HDC are from standard controls (like menu text). Even the HDC I CreateCompatibleDC from a type 1 becomes a type 2.

So, on one hand, I’m frustrated that Microsoft does not provide equal information to developers (another example may be that you cannot know the direction of a HBITMAP after it is created), on the other hand, I’m still wondering is there a way to distinguish these HDC.

Thanks for help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:37:47+00:00Added an answer on May 15, 2026 at 2:37 am

    I just mimic GDI’s behavior and everything works fine now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a sensible way to determine whether the current user can access an
Is there way that I can read the file from remote server using fopen
Is there a way I can detect an image URL, like: http://mysite.com/image.jpg but with
Is there a way I can determine how long an application pool (in IIS7)
Is there a way I can programmatically determine the filename of the .swf my
Is there a way that I can determine the fragmentation of a single file
Within some library class, is there a way I can I determine which webpage
Is there any way I can determine the currently focused control on a web
is there any way I can determine central point of FusionTablesLayer? I was thinking
Using Javascript, is there a way that I can determine the size of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.