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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:09:42+00:00 2026-06-15T19:09:42+00:00

Basically exactly what the title says. I would like to update the text that

  • 0

Basically exactly what the title says. I would like to update the text that a button contains every 1 second when the user presses that particular button. I have noted that when the program doesn’t have focus it works alright and the text refreshes correctly but when I am hovering over the program or when I am trying to click on it’s menu Windows inform me that the program is unresponsive and asks me if I want it terminated. When the loop finishes the program returns to its normal state. Also any action I might have done (like moving it around or closing it) while it was Sleep()-ing is executed after the loop. Here is a bit of code:

case ID_BUTTON_START:
// Code executed when pressing Start Button.
char startButtonText[30];  // Storing next loop text
 for (int i=5; i>0; i--)
    {
       sprintf(startButtonText, "Starting in ... %d", i);
       SendMessage(hwndButtonStart, WM_SETTEXT, 0, (LPARAM)(startButtonText));
       Sleep(1000);
     }

Is this normal? If not what’s causing this?

  • 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-15T19:09:43+00:00Added an answer on June 15, 2026 at 7:09 pm

    The WndProc does not process messages asynchronously within an application which means all messages are expected to be handled quickly and a return value delivered immediately. You must not Sleep in the UI thread since it will block other UI events from being processed. Any heavy work or synchronous requests/jobs which are likely to take a long time should be performed in worker threads. There are at least three viable options:

    1. Create a new (worker thread) for the task.
    2. If the task is likely to be done often, use a thread pool instead.
    3. Set and subscribe to timer events.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

...basically exactly what the title says. NetworkStream.Length is not implemented. What's an alternative? I'm
Basically the problem is exactly what the title says. My app works smoothly on
How can I store user contributed text while maintaing links, formatting, etc? (Basically exactly
Basically, my problem is exactly what it says in the title. When I try
Basically I've made a form in Cakephp 2.1 with a jQuery button that appends
Not exactly sure how to phrase this, sorry for ambiguous title. Anyways, here's basically
Sorry for the weird title, but well, that's exactly what I need. I know
Exactly what the title says. Here's my connection string: \SQLEXPRESS;Database=GGDBase;Integrated Security=SSPI;Trusted_Connection=true;Persist Security Info=False; The
Basically, the htaccess I use with apache says something like if the requested file
This is exactly the same question title as found here - I would also

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.