Solved

No WM_CREATE for CListCtrl?

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

732 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