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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:05:31+00:00 2026-06-06T07:05:31+00:00

A typical pattern is to create a child window in the message callback (

  • 0

A typical pattern is to create a child window in the message callback (WndProc) at message WM_CREATE:

LRESULT APIENTRY WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
...
switch (message) {
  case WM_CREATE:
  ....
  hwndChild[i] = CreateWindow (szChildClass[i], NULL, WS_CHILDWINDOW | WS_BORDER  ...

I perfectly understand this is a good opportunity, but is it a problem to do it any time later? One reason for doing so is that the child window is created within the same thread. But is there any other reason?

And how important is to create the child window in the same thread (as the parent)? As of ” Can a child thread of parent GUI dialog thread create a child window? ” this seems to be no general problem?

  • 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-06T07:05:33+00:00Added an answer on June 6, 2026 at 7:05 am

    It’s no problem to create your child window later, however, as you have mentioned, it should be created from the same thread.

    For instance, you can create a child window inside a WM_COMMAND message handler (e.g. when a user clicks on a button) or as a response to WM_TIMER.

    Creating a child window from another thread is a bad idea, as each thread has its own message queue. However, if you want another thread to initiate creating the window, you can work around it by sending a user-defined message to your window:

    1. Define your message (e.g. #define WM_CREATEMYWINDOW WM_USER + 123)
    2. From another thread post it to your window:

      PostMessage(g_hWnd, WM_CREATEMYWINDOW, 0, 0);
      
    3. In your window procedure create the child window:

      if (message == WM_CREATEMYWINDOW)
          hwndChild[i] = CreateWindow(...);
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My app uses the typical pattern of starting a CLLocationManager and then calling stopUpdatingLocation
What is a typical approach to using the repository pattern with .NET 1.1 (C#)?
I have a typical producer, consumer pattern. If the producer sends an object over
My typical usage of uploadify [www.uploadify.com] follows the following pattern: // to initialize $(#divid).uploadify({
I have a graph which I traverse using a typical visitor pattern. I've run
I'm looking for help identifying this design pattern and learning the typical vocabulary it
The typical pattern I've seen for using pthread_cond_wait is: pthread_mutex_lock(&lock); while (!test) pthread_cond_wait(&condition, &lock);
I'm working on a website with typical CRUD web usage pattern: similar to blogs
using c# vs2008 winforms. My standard forms have a typical usage pattern of Form
I am using TDD, and have a very typical coding pattern, using Eclipse to

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.