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

  • Home
  • SEARCH
  • 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 9038311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:27:28+00:00 2026-06-16T09:27:28+00:00

I have a problem. I created a Window in a thread. I created a

  • 0

I have a problem. I created a Window in a thread. I created a mutex so that the Window handle cannot be retrieved via a function until it is not 0.

I also used a while loop to make sure the handle is not 0.

Thing is, the handle is never 0 because CreateWindowEx returns a handle to the Window BEFORE the window is even displayed on screen.

So my mutex and while loop fails. I need to know when the window is fully displayed and finished doing whatever it has to do so I can draw on it from another thread.

The Handle is not 0, the DC is not 0. But when I draw, it draws nothing. If I put a Sleep(100) right after doing CreateWindowEx and ShowWindow, the window is displayed and the image is drawn to it correctly. I also tried while looping IsWindowVisisble(WindowHandle). That also fails.

I don’t want to sleep(100), what can I do?

  • 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-06-16T09:27:29+00:00Added an answer on June 16, 2026 at 9:27 am

    Don’t try to draw on the window from another thread.

    Post some data to the window and let it draw itself based on that data. It needs to be prepared to draw itself in response to a WM_PAINT anyway, and needs whatever data is necessary to do so in any case. Jumping through hoops to do the initial drawing differently is going to add a great deal of work and give you essentially nothing in return,.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weird problem. I create this window, but its blank until i
I have a problem regarding Android App. I have created an application that download
I have created a system that automatically registers function objects (functors) into a map
I try to create the simplest WinAPI window using assembly NASM. I have problem
I have problem with dynamically created image (JavaScript). I want to change the innerHTML
I have problem with Oracle 9.2 and JMS. I created PL/SQL routine to send
I have this problem getting my newly created php project on Netbeans work on
Im facing following problem I have created mentioned condition, but when I choose y
I have the problem running executable .jar file. I've created a project which contains
i have one problem with handling list,i have three class named as UserInf,userData,userProcess,i created

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.