Click here to Skip to main content
15,909,953 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to convert a CString to unsigned short Pin
Steve Echols28-Apr-06 12:26
Steve Echols28-Apr-06 12:26 
QuestionWin 3.x apps with VC6-8 Pin
Andre xxxxxxx28-Apr-06 5:40
Andre xxxxxxx28-Apr-06 5:40 
AnswerRe: Win 3.x apps with VC6-8 Pin
Gordon Brandly28-Apr-06 7:09
Gordon Brandly28-Apr-06 7:09 
GeneralRe: Win 3.x apps with VC6-8 Pin
Maximilien28-Apr-06 7:24
Maximilien28-Apr-06 7:24 
GeneralRe: Win 3.x apps with VC6-8 Pin
Gordon Brandly28-Apr-06 8:40
Gordon Brandly28-Apr-06 8:40 
GeneralRe: Win 3.x apps with VC6-8 Pin
Kevin McFarlane28-Apr-06 11:33
Kevin McFarlane28-Apr-06 11:33 
AnswerRe: Win 3.x apps with VC6-8 Pin
Michael Dunn28-Apr-06 9:38
sitebuilderMichael Dunn28-Apr-06 9:38 
QuestionInterface programming in MFC Pin
cmdill28-Apr-06 4:01
cmdill28-Apr-06 4:01 
I am trying to add an interface to my CFormView and CRecordView classes but not getting the results I would expect. Some code snippets...


// MainFrm.cpp
void CMainFrame::SelectView(UINT ViewID) {
...
TRACE("-1-\n");
((CViewControl*)pNewActiveView)->activate(); // <-- not working
//((CMasterView*)pNewActiveView)->activate(); // <-- this does work
TRACE("-2-\n");
}


// ViewControl.h
#pragma once
#include "StdAfx.h"

class CViewControl
{
public:
CViewControl();
~CViewControl();
virtual void activate();
};


// ViewControl.cpp
#include "StdAfx.h"
#include "viewcontrol.h"

CViewControl::CViewControl()
{
}

CViewControl::~CViewControl()
{
}

void CViewControl::activate()
{
TRACE("-----CViewControl::activate()\n");
}

// and here is one of the view clases that use it...
// MasterView.h
class CMasterView : public CRecordView, public CViewControl
{
...
public:
virtual void activate();
...

// MasterView.cpp
void CViewControl::activate()
{
TRACE("-----CMasterView::activate()\n");
}


..with the following output:
-1-
-2-

...expected:
-1-
-----CMasterView::activate()
-2-


A side note: If I make ~CViewControl() virtual, I get the following output:
...
-1-
Warning: calling DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called.
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.


Now I know there are different ways of doing the same thing, Create my on CMyRecordView and CMyFormView classes, but would like to know why the above code is not working like it should.

Any insight would be appreciated.



Chris
QuestionHello - problem in tree control in mfc Pin
Raja Bose C Leo28-Apr-06 3:08
Raja Bose C Leo28-Apr-06 3:08 
AnswerRe: Hello - problem in tree control in mfc Pin
David Crow28-Apr-06 3:28
David Crow28-Apr-06 3:28 
Questiondouble core processors support from VC Pin
9ine28-Apr-06 3:01
9ine28-Apr-06 3:01 
AnswerRe: double core processors support from VC Pin
toxcct28-Apr-06 3:44
toxcct28-Apr-06 3:44 
QuestionRe: double core processors support from VC Pin
David Crow28-Apr-06 4:36
David Crow28-Apr-06 4:36 
AnswerRe: double core processors support from VC Pin
Michael Dunn28-Apr-06 9:40
sitebuilderMichael Dunn28-Apr-06 9:40 
AnswerRe: double core processors support from VC Pin
Rick York28-Apr-06 10:26
mveRick York28-Apr-06 10:26 
Questionprogram windows servies in Visual C++ 6.0 Pin
prajwolkumar28-Apr-06 2:35
prajwolkumar28-Apr-06 2:35 
AnswerRe: program windows servies in Visual C++ 6.0 Pin
David Crow28-Apr-06 3:30
David Crow28-Apr-06 3:30 
QuestionEvents Pin
HakunaMatada28-Apr-06 2:30
HakunaMatada28-Apr-06 2:30 
AnswerRe: Events Pin
David Crow28-Apr-06 2:34
David Crow28-Apr-06 2:34 
AnswerRe: Events Pin
Roger Stoltz28-Apr-06 2:35
Roger Stoltz28-Apr-06 2:35 
GeneralRe: Events Pin
HakunaMatada28-Apr-06 2:42
HakunaMatada28-Apr-06 2:42 
AnswerRe: Events Pin
Roger Stoltz28-Apr-06 2:56
Roger Stoltz28-Apr-06 2:56 
QuestionWorking with Help [ F1 ] Pin
parichaybp28-Apr-06 1:12
parichaybp28-Apr-06 1:12 
QuestionDouble click event for RichEditControl Pin
mosali satish28-Apr-06 0:38
mosali satish28-Apr-06 0:38 
AnswerRe: Double click event for RichEditControl Pin
Trollslayer28-Apr-06 1:59
mentorTrollslayer28-Apr-06 1:59 

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.