Solved

Where subclass my list control ?

Posted on 1997-07-04
3
156 Views
Last Modified: 2013-11-20
I try subclass my list control from a list control created with resource editor , and in the OnInitDialog method I put the following:

...
MyListCtrl.SubclassWindow ( ListCtrl.m_hWnd );
...

In this line I receive a trap in the wincore.cpp ( Attach method ) .
What's wrong ?
0
Comment
Question by:nigro
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1302456
Since you are subclassing a dialog item, you should use CWnd::SubclassDlgItem.
0
 

Author Comment

by:nigro
ID: 1302457
Apparently the problem  was resolved commenting the line in DoDataExchange method that was relationing the list control ID with the list control data member (which was created with the Class Wizard).
0
 
LVL 1

Expert Comment

by:cnasarre
ID: 1302458
As far as I can see, you are subclassing twice your listbox...

If you have associated a CListBox(or derivated) member
MyListCtrl to the listbox control with the Member tab in
the Class Wizard, you have to do nothing by yourself :
just call CDialog::OnInitDialog() BEFORE using MyListCtrl
in your overloaded OnInitDialog()

That's the way is it supposed to work : thanks to MFC to do
the work
CDialog::OnInitDialog()
--> UpdateData()
   --> DoDataExchange()
      --> DDX_Control()
         --> SubclassWindow()  // that's it


I hope this help to understand

   cnasarre
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

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…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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