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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:46:55+00:00 2026-06-05T10:46:55+00:00

I’ve been working on creating a cross-platform GUI library, and I’ve run into an

  • 0

I’ve been working on creating a cross-platform GUI library, and I’ve run into an interesting snag. To make the interface nice, I’m trying to make it possible to create a button without a parent and then assign it a parent after the constructor has finished. I’ve gotten the code to mostly work, but clicking on the button causes the parent window to lose focus.
I’m creating the button using CreateWindowEx() and giving it the style WS_POPUP | BS_PUSHBUTTON and a null parent. The reason I’m using WS_POPUP is to avoid the title bar size from affecting the button’s dimensions; without it, the button is squashed. After creating the button, I use SetParent() and replace the WS_POPUP flag with WS_CHILD.

  • 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-05T10:46:58+00:00Added an answer on June 5, 2026 at 10:46 am

    The Windows API windows are not this flexible. As documented on MSDN you can’t change flags manually except by using an API call (e.g. ShowWindow() to change WS_VISIBLE). Why don’t you just delay the call to CreateWindowEx() until your library button object is assigned to a parent window?

    WS_POPUP means you want to create what a layman might call a window. In other words, a top-level frame that can contain widgets (WS_CHILD windows). The window you then set as the parent probably loses focus as button appears to the systm as a separate top-level window despite you changing the flags to WS_CHILD.

    There is more to a windows behaviour than its currently set flags. If Windows is designed sensibily, the two types of window (WS_POPUP and WS_CHILD) will be implemented by two completely different object under the hood, chosen depending on the flags passed to CreateWindowEx. Changing a flag isn’t going to magically morph the underlying object from one type to another.

    If the MSDN API docs don’t explicitly say that a flag is intended to be manipulated directly and there isn’t an API call to handle the change for you, then that aspect of a window’s identity is immutable.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I would like to run a str_replace or preg_replace which looks for certain words
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.