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 interested to work with data types and file formats. For example I want
I'm interested in making ghost preview elements of very complex DOM objects. While I
I am interested in logging all traffic that comes over port 443 for trouble-shooting
I'll explain my situation first: I'm interested of using the Bitmap constructor that takes
Im interested in a way one service activate users. The scenario is that I
I'm interested in implementing a 'user data' backup facility for the core data sqlite
I'm interested to know how can I detect (at the server side ) that
Trivial I know, but just interested I've got a stringbuilder variable, that I want
Interested in upgrading JAVA VERSION from JAVA 1.5 to JAVA 1.6 [oracle@server301 /]$ java
im interested how many api calls per second or per minute i can do

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.