Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

No WM_CREATE for CListCtrl?

Posted on 1997-05-14
2
Medium Priority
?
627 Views
Last Modified: 2013-11-19
I have derived a class from CListCtrl.  I need to set the control's column widths as soon as the control is attached to the CWnd.  Although WM_DESTROY is sent to the control, WM_CREATE is not, so that's out.  Is there a message that I can handle in my derived class that will come exactly one time, after the control is ready to accept SetColumnWidth()?  
0
Comment
Question by:laleonard
2 Comments
 
LVL 3

Accepted Solution

by:
Melange earned 100 total points
ID: 1301555
Is your control being accessed via the DDX_Control function or is it part of a CListView?

If the control is in a dialog and is being subclassed through DDX_Control, then one way that should work would be to override the PreSubclassWindow function. Your control won't yet be receiving messages in this function, but it should have the correct HWND to be able to call the CListCtrl functions like SetColumnWidth.

The reason you're not getting the WM_CREATE message is that it is sent immediately when the control is created and subclassing doesn't ocurr until later.

0
 

Author Comment

by:laleonard
ID: 1301556
(I am using DDX_CONTROL).  Great!  That makes sense; the WM_CREATE probably could be caught in the view.  PreSubclassWindow() works fine, though.  Thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question