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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:42:18+00:00 2026-06-11T12:42:18+00:00

I’d like to change a combobox control to owner-draw at runtime. In the resource

  • 0

I’d like to change a combobox control to owner-draw at runtime. In the resource script the control is layed out as a standard control.

I’ve experimented with setting the style bits to CBS_OWNERDRAW | CBS_HASSTRINGS but somehow this does not help.

Before doing subclass, set window style..

    // turn to ownerdraw
DWORD dwStyle = ::GetWindowLong(hwnd, GWL_STYLE);
dwStyle |= CBS_OWNERDRAWVARIABLE | CBS_HASSTRINGS;
SetWindowLong(hwnd, GWL_STYLE, dwStyle);

Does anybody know the trick?

  • 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-11T12:42:19+00:00Added an answer on June 11, 2026 at 12:42 pm

    Not all styles can be successfully changed at runtime after window creation – for example, even though it’s controlled via styles, you can’t change a wrapping multiline edit to a wrapping multiline edit at runtime; you need to create a whole new edit control, which is what Notepad does. I suspect that ownerdraw is a similar style that needs to be set at CreateWindow time and likely cannot be modified afterwards.

    Your best bet is to save the properties you care about – control ID, size and location – and also the HWND that was before it in the dialog. Destroy the old control and create a new identical replacement – but with the style you want. You’ll end up with a new HWND, so will have to ensure your code uses that instead of the old one from then on. And if the old control had keyboard focus when you deleted it, you should give the new control keyboard focus also so that focus doesn’t just ‘disappear’. Finally, use SetWindowPos(hwndPrev…) to move the new HWND into the right place in the Z-order so that tabbing and labels – which are based on Z-order – work with the new window the same way they did with the old.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to render a haml file in a javascript response like so:
I have an autohotkey script which looks up a word in a bilingual dictionary
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this

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.