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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:53:43+00:00 2026-06-12T11:53:43+00:00

I am currently developing a program (C++ Win32, Visual Studio 2012) that captures audio

  • 0

I am currently developing a program (C++ Win32, Visual Studio 2012) that captures audio signals from a microphone, computes a Fourier Transformation (you know, to get the frequencies in the audio) in another thread, and finally plots the results on a screen.

Everything works fine, except for the plotting, so this is a GUI related topic.

In WndProc, I get a message when a buffer is full and ready to be processed, and I call

boost::thread t(&ComputationThread,data);

to start the computation thread.

At the end of ComputationThread I send a message to the GUI thread to plot the data, using a predefined fixed value and the data pointer as arguments:

SendMessage(hWnd, WM_PAINT, PARAM_FFT_COMPUTED, (LPARAM)data);

This works fine as well, I get the message and I can also write the computed data to a file, however, drawing on the form (e.g. using SetPixel) has no effect, while it has an effect when wParam is not PARAM_FFT_COMPUTED, for example when the form is resized.

InvalidateRecthas no effect either.

What am I doing wrong?

Thanks in advance!

  • 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-12T11:53:44+00:00Added an answer on June 12, 2026 at 11:53 am

    You are not meant to send the WM_PAINT. It’s a specially synthesised message. You never post it or send it. Instead you call InvalidateRect or one of the related functions to get the system to generate WM_PAINT.

    And you are not meant to draw on a window outside of a WM_PAINT message handler. Or from a thread other than the GUI thread. Perhaps you aren’t doing any of those things, but they are common mistakes so it doesn’t hurt to mention it.

    If InvalidateRect does not work then something fundamental is wrong with your code. You need to fix that rather than try to make painting work by some other mechanism.

    So, the solution is to use InvalidateRect and fix whatever is broken in your WM_PAINT handler. Without seeing your WM_PAINT handler I would not like to speculate as to what is wrong.

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

Sidebar

Related Questions

I am currently developing a program that uses C#'s Dictionary container (specifically, SortedDictionary). This
Im currently developing a program that uses a scrollable/zoomable image as the main user
I'm currently developing a program that will generate reports based upon lead data. My
Currently am developing a program that solves (if possible) any given labyrinth of dimensions
I'm currently developing a program in python and I just noticed that something was
I'm currently developing a percussion tutorial program. The program requires that I can determine
We're currently developing some functionality for our program that needs OpenCV. One of the
I'm a visual studio newbie, currently developing a game using VS 2010 express, C#
I am currently developing a program that must handle multiple threads. When I start
I'm currently developing a program that scans the desktop for opened windows and stores

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.