How to change a pixel color with out using SetPixel() function

        How can I change the Pixel color of our window DC with out using the function SetPixel() function
in Vc++, I am searching for a method for getting the direct pointer address of our window DC location.
So I can change the RGB value using memory address (Pointer)
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi inampudi,

IMO direct access to pixel's RGB values of a window's DC is not possible. For example see this discussion:

You can create a memory device context (CreateCompatibleDC). For this you can create DIB (i.e. CreateDIBSection) and access the pixels there - then use BitBlt to draw this bitmap to the window ...

Hope that helps,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
inampudi1Author Commented:
Hi experts,
                      can We create a DIB which will automatically refresh to the DC with out calling BitBlt or StretchBlt etc like functions . Because i want a very fast method. Is BitBlt() copy the entire image to the DC or Just set The pointer.Or is there any method to directly set out DIB pointer to our Window DC.
Hi again,

no, IMO you can't do anything else than blitting the bitmap to the real DC (at least not in Windows GDI) - the problem simply is you would need to have access to the graphics-card's memory which is blocked - the only way to achive such things would be to use DirectX/DirectDraw. Anyway, how fast do you want to have it? BitBlt isn't such slow - for example I once wrote a bitmap roation test program which managed to rotate and paint a 800x600 pixel image on a 2,4 GHz machine with about 160 fps.

BitBlt copies the image (or a part of it) to the real DC ...

inampudi1Author Commented:
HI Zoppo,
                     Your Guidance is Good, it is well cleared..
And it is very helpfull to me...
That's fine, I'm glad I could help ...

Have a nice day,

best regards,

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.