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 6880547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:59:17+00:00 2026-05-27T04:59:17+00:00

There is this weird bug in my program that I’m trying to fix, but

  • 0

There is this weird bug in my program that I’m trying to fix, but I’m really at a loss for what it could be. This part of my program has a dialog which shows previews of various items using MFC/GDI. When I scroll through different items, sometimes the preview image just disappears and goes blank. However, it:

  • Only happens on some machines
  • Apparently happens on both Windows 7 and XP
  • Doesn’t happen on the same item every time
  • Item IS STILL THERE when one takes a screenshot, but it is blank when viewing it normally.
  • Seems to happen at random places throughout the code when I’m attempting to trace through it with breakpoints. It’s not always in the same location that the screen goes from image to blank, which leads me to believe that it’s not happening in the same thread as my main thread, even though that’s really the only thread that’s not blocked at that point. That means that it’s happening in a windows thread or something, doesn’t it?

I’m assuming it’s a race condition of some sort, but the behaviour of the preview in screenshots, in particular, rather confuses me. Why would it be fine when taking a screenshot but be blank when viewing it on screen? Is there some mechanic of the “printscreen” that bypasses what’s displyed or updated on the screen?

I realize that I haven’t given much information and that people obviously can’t help much, but if anyone could think of ANYTHING, it would be much appreciated 🙂

Thanks!

  • 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-27T04:59:17+00:00Added an answer on May 27, 2026 at 4:59 am

    Another theory: GDI resource leak

    If you forget to free your GDI objects, weird things start to happen – including unpainted areas.

    1. Run taskmgr.exe and add the “GDI Objects” column.
    2. Run your software and monitor the GDI object count. Does it stabilize?
    3. If your GDI Object count does not stabilize, look in your relevant WM_PAINT handlers.

    Here’s an example of a GDI leak:

    void CMyWnd::OnPaint()
    {
        CPaintDC dc(this);
        dc.SelectObject(&font);
    }
    

    Selected GDI objects must always be deselected:

    void CMyWnd::OnPaint()
    {
        CPaintDC dc(this);
        CFont *pOldFont = dc.SelectObject(&font);
        // Use font
        dc.SelectObject(pOldFont);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's this program, pdftotext, that can convert a pdf file to a text file.
There was this problem that has been asked about implementing a load byte into
I have this really weird bug at my page. I wrote this comment system
I have this really weird bug. When I scroll down my table view, down
I found this very weird bug that I can't understand. First of all inside
I am writing an HTML5 page but there is a weird bug in Chrome
There is this example code, but then it starts talking about millisecond / nanosecond
there is this check-in-out program here at my workplace, it only takes the data
There's a piece of code that looks like this. The problem is that during
I'm working on a bug where I have an MFC application that does weird

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.