Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!evax!utacfd!letni!rwsys!spudge!johnm From: johnm@spudge.UUCP (John Munsch) Newsgroups: comp.windows.ms.programmer Subject: Re: RGB() Problems? Message-ID: <28293@spudge.UUCP> Date: 14 Mar 91 23:30:26 GMT References: Reply-To: johnm@spudge.UUCP (John Munsch) Distribution: comp.windows.ms.programmer Organization: Friends of Guru Bob Lines: 20 In article dkemper@oracle.com (David J. Kemper) writes: >The problem arises when I want to read pixels from the display. I >create a screen device context (CreateDC("DISPLAY", NULL, NULL, NULL) >and try to read from it using GetPixel(). Well, the DWORD colorref I >get back ALWAYS has the high byte of 0, meaning it's a direct RGB (?). >The problem is that this direct color is WRONG. It's a match when the >color happens to be a standard Windows color (as in window title bars, >menu backgrounds, etc), but is "garbage" when it is one of my enhanced >color palette entries. Hmm... I've never tried doing that sort of thing with a CreateDC. I assume you have the handle to the window you're doing all this in available. If so, try doing a GetDC() on the window handle and performing the GetPixels on that DC handle instead. P.S. If you are grabbing large sections of the screen via GetPixel() you may find it more economical (timewise) to use something like GetDIBits() instead. John Munsch