Click here to Skip to main content
15,900,698 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow not to lose focus when a child dialog is created Pin
materatsu11-Feb-09 5:36
materatsu11-Feb-09 5:36 
QuestionRe: How not to lose focus when a child dialog is created Pin
David Crow11-Feb-09 5:37
David Crow11-Feb-09 5:37 
AnswerRe: How not to lose focus when a child dialog is created Pin
materatsu11-Feb-09 6:10
materatsu11-Feb-09 6:10 
GeneralRe: How not to lose focus when a child dialog is created Pin
David Crow11-Feb-09 6:15
David Crow11-Feb-09 6:15 
AnswerRe: How not to lose focus when a child dialog is created Pin
Code-o-mat11-Feb-09 6:10
Code-o-mat11-Feb-09 6:10 
GeneralRe: How not to lose focus when a child dialog is created Pin
Perspx11-Feb-09 6:14
Perspx11-Feb-09 6:14 
GeneralRe: How not to lose focus when a child dialog is created Pin
Code-o-mat11-Feb-09 6:17
Code-o-mat11-Feb-09 6:17 
AnswerRe: How not to lose focus when a child dialog is created Pin
Perspx11-Feb-09 6:11
Perspx11-Feb-09 6:11 
GeneralRe: How not to lose focus when a child dialog is created Pin
materatsu11-Feb-09 6:44
materatsu11-Feb-09 6:44 
QuestionHow to block unwanted websites using socket programming? Pin
ArashFar11-Feb-09 4:49
ArashFar11-Feb-09 4:49 
AnswerRe: How to block unwanted websites using socket programming? Pin
David Crow11-Feb-09 5:36
David Crow11-Feb-09 5:36 
GeneralRe: How to block unwanted websites using socket programming? Pin
ArashFar11-Feb-09 6:22
ArashFar11-Feb-09 6:22 
GeneralRe: How to block unwanted websites using socket programming? Pin
David Crow11-Feb-09 6:25
David Crow11-Feb-09 6:25 
GeneralRe: How to block unwanted websites using socket programming? Pin
led mike11-Feb-09 7:40
led mike11-Feb-09 7:40 
GeneralRe: How to block unwanted websites using socket programming? Pin
ArashFar14-Feb-09 7:40
ArashFar14-Feb-09 7:40 
QuestionRead KKEY_CURRENT_USER Registry? Pin
Software200711-Feb-09 4:48
Software200711-Feb-09 4:48 
AnswerRe: Read KKEY_CURRENT_USER Registry? Pin
David Crow11-Feb-09 5:01
David Crow11-Feb-09 5:01 
GeneralRe: Read KKEY_CURRENT_USER Registry? Pin
Software200711-Feb-09 5:06
Software200711-Feb-09 5:06 
GeneralRe: Read KKEY_CURRENT_USER Registry? Pin
led mike11-Feb-09 5:15
led mike11-Feb-09 5:15 
GeneralRe: Read KKEY_CURRENT_USER Registry? Pin
Software200711-Feb-09 5:20
Software200711-Feb-09 5:20 
GeneralRe: Read KKEY_CURRENT_USER Registry? Pin
Software200711-Feb-09 5:59
Software200711-Feb-09 5:59 
QuestionClass wrapper Pin
jung-kreidler11-Feb-09 4:29
jung-kreidler11-Feb-09 4:29 
Hi all,

I've got a small problem with derived classes and a wrapper class. To show you what my problem is, I write down some code. Here's what I do now:

class Base
{
doFunc1();
virtual doFunc2();
}

class Der1 : public Base
{
doFunc2();
}
class Der2 : public Base
{
doFunc2();
}

class Wrap
{
Der1 *d1;
Der2 *d2;
doFunc1();
doFunc2();
}

Wrap::doFunc1()
{
if(somecondition)
d1->doFunc1();
else
d2->doFunc1();
}

Wrap::doFunc2()
{
if(somecondition)
d1->doFunc2();
else
d2->doFunc2();
}

From my program I can call:
Wrap::doFunc1();

Now I want to remove the Wrapper calls and replace them with function pointers like this:
class Wrap
{
Der1 *d1;
Der2 *d2;
(*doFunc1)();
(*doFunc2)();
}

Wrap::Wrap
{
if(somecondition)
this->doFunc1 = &Der1::doFunc1;// causes C2440
this->doFunc2 = &Der1::doFunc2;// causes C2440
else
this->doFunc1 = &Der1::doFunc1;// causes C2440
this->doFunc2 = &Der1::doFunc2;// causes C2440
}

From my program I would like to call:
Wrap::doFunc1();

The line this->doFunc1 = ... causes C2440: type cast: cannot convert from (__thiscall Der1::*)() to (__cdecl*)().

I know that class members are not the same as normal c-functions, this causes the __thiscall to __cdecl error, but I thought that there is some trick to get it to work.
Any ideas?

jung-kreidler
AnswerRe: Class wrapper Pin
«_Superman_»11-Feb-09 15:38
professional«_Superman_»11-Feb-09 15:38 
GeneralRe: Class wrapper Pin
jung-kreidler11-Feb-09 20:15
jung-kreidler11-Feb-09 20:15 
QuestionKeypad Dialog Pin
Reagan Conservative11-Feb-09 3:42
Reagan Conservative11-Feb-09 3:42 

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.