Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

CuteBug

MFC- GetPixel doesn't work!!!

This topic is 5553 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In an SDI application I created a new Class, say, CTest. In one of the member functions of CTest I included the following code -
void CTest::SomeFunc(...)
{
  ...
     int x;
     int y;
  
  ...
  
  CFrameWnd* pFrame = (CFrameWnd*)(AfxGetApp()->m_pMainWnd);
  CMyAppView* pView = (CMyAppView*)(pFrame->GetActiveView());

  CClientDC dc(pView);

  COLORREF pix = dc.GetPixel(x, y);

  ...
}
 
But the function GetPixel doent return the correct value of the the pixel color at (x,y); when I debugged it pix always had the value 0xffffffff. Please help... "There is a Bug in every Code!"

Share this post


Link to post
Share on other sites
Advertisement
Was the view visible when you were debugging? If it was hidden by the debugger, GetPixel would return 0xffffffff.



Update GameDev.net system time campaign - success at last

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!