Solved

Where subclass my list control ?

Posted on 1997-07-04
3
163 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Title # Comments Views Activity
set up trigger (or something) to rename files (starting with ATL) in a linux directory 6 55
WinWaitActive parameters 12 31
twoTwo  challenge 35 108
Capture logon name 13 88
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. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

830 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