Click here to Skip to main content
15,925,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Subclassing Pin
Maxwell Chen11-May-06 23:14
Maxwell Chen11-May-06 23:14 
GeneralRe: Subclassing Pin
toxcct11-May-06 23:31
toxcct11-May-06 23:31 
GeneralRe: Subclassing Pin
Scorpio11-May-06 23:36
Scorpio11-May-06 23:36 
GeneralRe: Subclassing Pin
toxcct11-May-06 23:37
toxcct11-May-06 23:37 
GeneralRe: Subclassing Pin
VinayCool11-May-06 23:46
VinayCool11-May-06 23:46 
GeneralRe: Subclassing Pin
BadKarma12-May-06 2:57
BadKarma12-May-06 2:57 
GeneralRe: Subclassing Pin
toxcct12-May-06 3:03
toxcct12-May-06 3:03 
GeneralRe: Subclassing Pin
BadKarma12-May-06 8:30
BadKarma12-May-06 8:30 
Suppose one has a working application with the following structure
COrgMainFrame and COrgView loaded via a dll or unrelated part of the application.

At some point in time you need to change the behaviour of one of the classes, but you are prohibitted to do this at design time time. So you can't/may not create/use CMyNewView or CMyDifferentMainFrame. The only way is to implement this is at runtime. This means override the normal behaviour of the class at runtime, by loading a new windowproc function into the message handeling part of that window you want to change. Once this is done all windows messages passes your function first instead of the PreTranslateMessage function that normaly parses the messages. So one can delete certain messages being send to the normal PreTranslateMessage function or add new functions; and altering as such the behaviour of the Original class. This doesn't have anything to do with inheritance or objects this is 'normal' windows behaviour.

Each windowclass needs to be registerd in windows, this is normaly done by the MFC classes at creation of the window, this is needed to let windows now what windowproc needs to be called for this kind of window. Using the technique explained above one can alter the behaviour of one single instance of that class/window without changing the behaviour of other instances of the same object.

I hope I have explained it clearly ennough what I meant. Smile | :)

Like i said before I always thought that this was called subclassing in windows

codito ergo sum
AnswerRe: Subclassing Pin
VinayCool11-May-06 23:39
VinayCool11-May-06 23:39 
GeneralRe: Subclassing Pin
toxcct11-May-06 23:41
toxcct11-May-06 23:41 
GeneralRe: Subclassing Pin
VinayCool11-May-06 23:43
VinayCool11-May-06 23:43 
GeneralRe: Subclassing Pin
Scorpio11-May-06 23:43
Scorpio11-May-06 23:43 
GeneralRe: Subclassing Pin
toxcct11-May-06 23:45
toxcct11-May-06 23:45 
GeneralRe: Subclassing Pin
voorugonda prashanth11-May-06 23:45
voorugonda prashanth11-May-06 23:45 
AnswerRe: Subclassing Pin
VinayCool11-May-06 23:47
VinayCool11-May-06 23:47 
GeneralRe: Subclassing Pin
voorugonda prashanth11-May-06 23:51
voorugonda prashanth11-May-06 23:51 
GeneralRe: Subclassing Pin
VinayCool11-May-06 23:54
VinayCool11-May-06 23:54 
GeneralRe: Subclassing Pin
vikramlinux12-May-06 0:01
vikramlinux12-May-06 0:01 
GeneralRe: Subclassing Pin
Scorpio12-May-06 0:03
Scorpio12-May-06 0:03 
GeneralRe: Subclassing Pin
voorugonda prashanth12-May-06 0:20
voorugonda prashanth12-May-06 0:20 
QuestionWindows Messaging Pin
Scorpio11-May-06 22:25
Scorpio11-May-06 22:25 
QuestionDebug log into a file Pin
gaze_11-May-06 22:20
gaze_11-May-06 22:20 
AnswerRe: Debug log into a file Pin
Axter11-May-06 23:55
professionalAxter11-May-06 23:55 
Questiontemplate problem Pin
NorGUI11-May-06 22:00
NorGUI11-May-06 22:00 
AnswerRe: Template with all informations Pin
Stephen Hewitt11-May-06 22:12
Stephen Hewitt11-May-06 22:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.