Solved

No WM_CREATE for CListCtrl?

Posted on 1997-05-14
2
564 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 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Whole sheet autoscrub still needed 19 50
while loop over for loop 7 103
modThree challenge 4 90
Work with App store 7 52
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: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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