troubleshooting Question

TextOut to a DIB always in black

Avatar of skink91
skink91 asked on
System Programming
6 Comments1 Solution645 ViewsLast Modified:
Hi.

I'm having a problem with a DIB that I've selected into a DC to do a TextOut call to.  It seems that the text is always BLACK no matter what I do... and I need the text to be white.  Any suggestions?  Thanks.  (sample code below)

      HDC hDC = GetDC(hMainWnd);
      HDC dcTmp = CreateCompatibleDC(hDC);
      ReleaseDC(hMainWnd,hDC);
      HBITMAP hOldBMP = (HBITMAP)SelectObject(dcTmp,m_dibWindow->GetBitmap());
      HFONT hOldFont = (HFONT)SelectObject(dcTmp,m_hFont);
      SetTextColor(dcTmp,RGB(255,255,255));
      SetBkMode(dcTmp,TRANSPARENT);
        TextOut(dcTmp,5,350,"330",strlen("330"));
      SelectObject(dcTmp, hOldFont);
      SelectObject(dcTmp,hOldBMP);
      GdiFlush();
      DeleteDC(dcTmp);

      // at this point i BLT the DIB to a memory DC and Invalidate the main window...

ASKER CERTIFIED SOLUTION
Alkali_Guy

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros