Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

No WM_CREATE for CListCtrl?

Posted on 1997-05-14
2
Medium Priority
?
614 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

722 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