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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:57:00+00:00 2026-05-23T22:57:00+00:00

How can I do that? The following seems to work: CreateWindowEx(WS_EX_TOOLWINDOW, szToolWndClass, Title, WS_OVERLAPPEDWINDOW

  • 0

How can I do that?

The following seems to work:

CreateWindowEx(WS_EX_TOOLWINDOW, szToolWndClass, "Title",
WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 240, 320,
hWnd, NULL, hInstance, NULL)

But this doesn’t (the window is not displayed):

CreateWindowEx(WS_EX_TOOLWINDOW, szToolWndClass, "Title",
WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 240, 320,
hWnd, (HMENU) IDD_TOOL, hInstance, NULL)

However, it works when I add the WS_CHILD style, but that doesn’t create a floating window.

  • 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-23T22:57:02+00:00Added an answer on May 23, 2026 at 10:57 pm

    Top-level windows use the ID slot as the HMENU (or rather, child windows use the HMENU slot as the control ID); so child windows can’t have HMENUs, and top-level HWNDs can’t have IDs.

    What’s likely happening is that when you omit WS_CHILD, windows treats the ID as a HMENU, and since it’s not a valid HMENU, fails the CreateWindow call.

    Generally speaking, an ID only makes sense in the context of a known container. So in the context of a dialog, IDs make sense, because the dialog owns the controls in it, and the author can ensure there’s no duplicates – and GetDlgItem will do something sensible.

    But on the desktop, every window is from a different source, so there would be no way to ensure unique IDs, so the concept wouldn’t really make sense there anyhow.

    Your best bet is perhaps to save away the HWND itself, and use it directly when needed.

    One thing to be aware of is that when you don’t use WS_CHILD, your new window is actually a child of the desktop window, but is owned by the HWND you pass in, it’s not a child of that window. Enumerating the child windows of that owner window will not return your new window.

    Raymond Chen (who’s blog should be considered required reading for all Win32 devs) has a good explanation of the parent vs owner issue here.

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

Sidebar

Related Questions

I can't believe that the following statement seems to be still true So, I
How can I quickly prove that the following class is not thread-safe (as it
I have the following XML Document (that can be redesigned if necessary) that stores
Is there some tool that can automatically convert the following c style code A
Following on from this question I now have code that can attach to a
I am using the following InnoDB tables in mysql to describe records that can
I'm looking for an SQL client app that can display subdatasheets like the following:
I m having the following code, however, I can see that the radio button
How can I correct the following so that I don't receive a syntax error
Can someone recommend a hosted solution that answers the following requirements (I have seen

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.