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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:53:28+00:00 2026-06-08T12:53:28+00:00

I am back with an experimental project that starts with this: I have an

  • 0

I am back with an experimental project that starts with this:
I have an array of 10000 elements of POINT type. They are supposed to be pixels with x and y coordinate, to be drawn on a window (SetPixel()). I have created a simple function that creates the DC, get each POINT from the array and draws it on the screen:

void draw_points() {
    HDC hdc = GetDC(hWnd);
    for (int i = 0; i < 10000; i++) {
        SetPixel(hdc, points[i].x, points[i].y, RGB(0, 0, 0));
    }
    ReleaseDC(hWnd, hdc);
}

Well, I placed this function inside the main loop of the WinMain() function. It works. I can see the points being drawn on the screen. The problem is that while the points are being displayed I can’t do anything else, so I found out that I would need asynchronous functions, like in Java. That’s because I would like to be able to add, remove, modify points from the array while the draw_points() function is running.

I don’t need any result from it, I just want it to run in another thread while I do whatever I want with other functions.
So, my question: what does Windows API offer me for this? Which is the usual way to do it? Do I need some external library? I just don’t know how to start. I hope you understand what I want. 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-06-08T12:53:31+00:00Added an answer on June 8, 2026 at 12:53 pm

    You shouldn’t call this from the main loop. Instead you should call it when you get a WM_PAINT event in your window message loop.

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

Sidebar

Related Questions

Recently I have started to implement new experimental feature for my project. Unfortunately I
I have a project which contains different components that everyone works on. We have
I have a build system that takes a git repository, goes back to a
Back in my days as a BeOS programmer, I read this article by Benoit
Back in the past, i found a third party webpage that was able to
I'm working on a project that is using code from an OpenSource project. One
I have a piece of templated code that is never run, but is compiled.
I would like to do some experimental work in a hg project. So I
I have created an app that incorporates a table view, detail view, and a
I have two functions that I have overloaded for my debug class: template<class IteratorT>

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.