Click here to Skip to main content
16,006,440 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A Test Program? Pin
yellowine22-Feb-02 6:04
yellowine22-Feb-02 6:04 
QuestionVC7 support for 64-bit targets? Pin
Ravi Bhavnani20-Feb-02 4:10
professionalRavi Bhavnani20-Feb-02 4:10 
AnswerVC6 & Intel C++ 64bit compiler Pin
Ravi Bhavnani20-Feb-02 4:53
professionalRavi Bhavnani20-Feb-02 4:53 
GeneralMyAtlCtrlInstace->PassMetafile(hMyMetafile) ( VT_METAFILE) Pin
Braulio Dez20-Feb-02 3:48
Braulio Dez20-Feb-02 3:48 
GeneralRe: MyAtlCtrlInstace->PassMetafile(hMyMetafile) ( VT_METAFILE) Pin
Mazdak20-Feb-02 4:02
Mazdak20-Feb-02 4:02 
GeneralRe: MyAtlCtrlInstace->PassMetafile(hMyMetafile) ( VT_METAFILE) Pin
Braulio Dez20-Feb-02 4:09
Braulio Dez20-Feb-02 4:09 
GeneralRe: MyAtlCtrlInstace->PassMetafile(hMyMetafile) ( VT_METAFILE) Pin
Mazdak20-Feb-02 4:32
Mazdak20-Feb-02 4:32 
GeneralProblems with inheritance Pin
20-Feb-02 3:22
suss20-Feb-02 3:22 
I'm having some problems with inheritance and virtual functions. Supose the following classes:

class CMyClass
{
virtual void DoSomething() = 0;
}

class CMyDialog : public CDialog, public CMyClass
{
void Init()
{
m_oUsingClass.Init(this);
}

virtual void DoSomething()
{
}

CUsingClass m_oUsingClass;
}

class CUsingClass
{
void Init(CWnd *pWnd)
{
m_pWnd = pWnd;
m_pMyClass = (CMyClass *)pWnd; // error - it doesn't work

m_pMyClass->DoSomething(); // error - caused by prior error
}

CWnd *m_pWnd;
CMyClass *m_pMyClass;
}


When I assign "m_pMyClass = (CMyClass *)pWnd;" it doesn't work. So I can't call virtual function DoSomething() defined in CMyDialog class.

How can I do this?

What I need is to have a class (CMyDialog) that is derived from CDialog and CMyClass and in another class (CUsingClass) I need to access CDialog and CMyClass (passed by "this" parameter in m_oUsingClass.Init(this)). Can I do it simply passing this as CWnd * or I need to have two parameters in CUsingClass::Init(CWnd *, CMyClass *) and I have to pass "this" parameter twice in CMyDialog (m_oUsingClass.Init(this, this))?

If you have any idea about how can I do this, or if you know where can I get documentation explaining why this doesn't work, I would appreciate.

Thanks

Vanessa
GeneralRe: Problems with inheritance Pin
Joaquín M López Muñoz20-Feb-02 3:25
Joaquín M López Muñoz20-Feb-02 3:25 
GeneralRe: Problems with inheritance Pin
Stan Shannon20-Feb-02 4:10
Stan Shannon20-Feb-02 4:10 
GeneralMDI application Pin
20-Feb-02 1:51
suss20-Feb-02 1:51 
GeneralRe: MDI application Pin
Jonathan Craig20-Feb-02 3:12
Jonathan Craig20-Feb-02 3:12 
General24 errors Pin
-Dy20-Feb-02 0:48
-Dy20-Feb-02 0:48 
GeneralRe: 24 errors Pin
Roger Allen20-Feb-02 1:22
Roger Allen20-Feb-02 1:22 
GeneralRe: 24 errors Pin
-Dy20-Feb-02 1:51
-Dy20-Feb-02 1:51 
GeneralRe: 24 errors Pin
Sef Tarbell20-Feb-02 10:23
Sef Tarbell20-Feb-02 10:23 
GeneralHour Glass Pin
AJ12320-Feb-02 0:44
AJ12320-Feb-02 0:44 
Generalconverting a class to a reusable compiled object Pin
Kuniva20-Feb-02 0:44
Kuniva20-Feb-02 0:44 
GeneralRe: converting a class to a reusable compiled object Pin
Jon Hulatt20-Feb-02 0:56
Jon Hulatt20-Feb-02 0:56 
GeneralRe: converting a class to a reusable compiled object Pin
Joaquín M López Muñoz20-Feb-02 2:12
Joaquín M López Muñoz20-Feb-02 2:12 
QuestionHow Do I Detect Activity In a CEdit Control ? Pin
MJ_Karas20-Feb-02 0:37
MJ_Karas20-Feb-02 0:37 
AnswerRe: How Do I Detect Activity In a CEdit Control ? Pin
Jon Hulatt20-Feb-02 0:58
Jon Hulatt20-Feb-02 0:58 
GeneralRe: How Do I Detect Activity In a CEdit Control ? Pin
MJ_Karas20-Feb-02 16:03
MJ_Karas20-Feb-02 16:03 
GeneralDriverName Pin
19-Feb-02 23:50
suss19-Feb-02 23:50 
Questionhow do I Change the Font size of DrawText? Pin
John Cruz19-Feb-02 23:35
John Cruz19-Feb-02 23:35 

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.