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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:35:29+00:00 2026-05-13T05:35:29+00:00

I am interested in allocating pointers, storing those in the LPARAM data of a

  • 0

I am interested in allocating pointers, storing those in the LPARAM data of a comboboxex control, and making that control responsible for deleting those pointers when it is destroyed.

Since I am working in MFC, I can subclass a CComboBoxEx, and add either a message handler or a virtual member function.

The question is: Is this pattern possible with Win32 / MFC?

Basically, how does a control get notified that its corresponding HWND is being destroyed?

The documentation for WM_DESTROY:

The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window procedure of the window being destroyed after the window is removed from the screen. (Emphasis Mine)

Unfortunately, my vague recollection is that this means that OnDestroy() is too late for handling anything that requires interacting with the associated HWND, no?

Can I query the elements in the comboboxex during OnDestroy()? Is there another hook I can use that occurs “Just before my window / control is destroyed (instead of after!)?”

I wonder if I overrode CBEM_DELETEITEM for my subclass and forced it to delete the LPARAM data. Are all items explicitly deleted when a comboboxex is destroyed? If so, are they all destroyed via that message (does the control send that message to itself?)

  • 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-13T05:35:30+00:00Added an answer on May 13, 2026 at 5:35 am

    During OnDestroy() your window will still be valid — if it weren’t, your window wouldn’t have gotten the message at all, since it’s sent via the standard Windows messaging system.

    You are on the right track — this type of scenario is what OnDestroy() is for.

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

Sidebar

Related Questions

I am interested in creating a routine that would query the currently running cache
I'm interested in writing javascript that will programmatically perform a screen capture of what
I am interested in the best approach to making sure your Linux & GTK
Im interested in implementing a JQuery solution for a Panel Selector that seems very
Interested if anyone has used VSTS Database Edition extensively and, if so, which features
I'm interested in seeing a good diff algorithm, possibly in Javascript, for rendering a
I am interested in moving a number of my projects from Visual Studio and
I'm interested in learning some (ideally) database agnostic ways of selecting the n th
Although I'm specifically interested in web application information, I would also be somewhat curious
I'm interested in doing comparisons between the date string and the MySQL timestamp. However,

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.