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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:15:43+00:00 2026-05-12T05:15:43+00:00

I have a very simple Win32 application that uses CAtlExeModuleT. The module simply creates

  • 0

I have a very simple Win32 application that uses CAtlExeModuleT. The module simply creates a class CTestWindow derived from CWindowImpl. It just has a single message handler for WM_PAINT. After I create the window and display it, the OnPaint method (WM_PAINT message) is called infinitely and there by consumes 100% CPU.

The code that creates the window is very simple:

    m_pMainWnd = new CTestWindow();
if(NULL == m_pMainWnd->Create(NULL, CWindow::rcDefault, _T("Test Window"), WS_OVERLAPPEDWINDOW, 0, hMenu)){
    DWORD dwErr = GetLastError();
    return E_FAIL;
}
m_pMainWnd->ShowWindow(nShowCmd);

The OnPaint message handler is very simple as well (it doesn’t do anything):

LRESULT CTestWindow::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
    // TODO: Add your message handler code here and/or call default

    return 0;
}
  • 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-12T05:15:44+00:00Added an answer on May 12, 2026 at 5:15 am

    My guess is that you are not validating the window in your paint handler.

    An application must call BeginPaint
    and EndPaint in response to WM_PAINT
    messages, or pass the message to the
    DefWindowProc function to validate the
    window. DefWindowProc validates the
    update region; it can send the
    WM_ERASEBKGND message if the window
    background needs to be erased.

    This would mean the OS will think the window still needs to be painted, and call you again.

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

Sidebar

Related Questions

I have a very simple script that creates a user: <?php include 'mysqlserver.php'; session_start();
I have very simple form that gets values in JSON format from searchAlbum.php .
I have written very very simple console application which supports some command line options.
I have very simple query like this: SELECT * FROM `all_conversations` WHERE `deleted_1` !=
I have very simple query that calls a UDF which splits a field by
I have a very simple problem. I have an application which is written in
I have a Win32 application that includes an EXE, an ActiveX control (DLL) and
Very simple problem. I have a Delphi application and I want to restrict access
I have very simple XML in a string that I'm trying to load via
I have a python script that runs on windows and uses win32 extensions and

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.