Click here to Skip to main content
15,918,967 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCode changes req. to improve 64 bit application performance Pin
am 200928-Aug-11 18:22
am 200928-Aug-11 18:22 
AnswerRe: Code changes req. to improve 64 bit application performance Pin
Rolf Kristensen28-Aug-11 20:30
Rolf Kristensen28-Aug-11 20:30 
AnswerRe: Code changes req. to improve 64 bit application performance Pin
MicroVirus29-Aug-11 1:33
MicroVirus29-Aug-11 1:33 
QuestionManifest in resource script? Pin
Groulien28-Aug-11 9:57
Groulien28-Aug-11 9:57 
AnswerRe: Manifest in resource script? Pin
David Magnotti28-Aug-11 13:34
David Magnotti28-Aug-11 13:34 
AnswerRe: Manifest in resource script? Pin
David Crow29-Aug-11 4:26
David Crow29-Aug-11 4:26 
AnswerRe: Manifest in resource script? Pin
i007-Jan-13 14:20
i007-Jan-13 14:20 
QuestionMDI child windows behaviuor like VC6 editor Pin
_Flaviu26-Aug-11 23:03
_Flaviu26-Aug-11 23:03 
QuestionAll window handle from point Pin
Member 296547126-Aug-11 8:06
Member 296547126-Aug-11 8:06 
AnswerRe: All window handle from point Pin
Charles Oppermann26-Aug-11 10:24
Charles Oppermann26-Aug-11 10:24 
AnswerRe: All window handle from point Pin
«_Superman_»27-Aug-11 13:45
professional«_Superman_»27-Aug-11 13:45 
AnswerRe: All window handle from point Pin
Code-o-mat28-Aug-11 21:54
Code-o-mat28-Aug-11 21:54 
GeneralRe: All window handle from point Pin
Charles Oppermann30-Aug-11 10:42
Charles Oppermann30-Aug-11 10:42 
QuestionLoad and Display a Dialog Box from Simple Win32 DLL with No MFC support Pin
kamaljagesia25-Aug-11 21:33
kamaljagesia25-Aug-11 21:33 
QuestionRe: Load and Display a Dialog Box from Simple Win32 DLL with No MFC support Pin
CPallini25-Aug-11 21:55
mveCPallini25-Aug-11 21:55 
QuestionIs memory leak possible when I dont delete the object Pin
manoharbalu25-Aug-11 19:12
manoharbalu25-Aug-11 19:12 
AnswerRe: Is memory leak possible when I dont delete the object Pin
Eugen Podsypalnikov25-Aug-11 19:32
Eugen Podsypalnikov25-Aug-11 19:32 
AnswerRe: Is memory leak possible when I dont delete the object Pin
Stefan_Lang25-Aug-11 22:38
Stefan_Lang25-Aug-11 22:38 
GeneralRe: Is memory leak possible when I dont delete the object Pin
manoharbalu26-Aug-11 0:41
manoharbalu26-Aug-11 0:41 
GeneralRe: Is memory leak possible when I dont delete the object Pin
Stefan_Lang26-Aug-11 2:05
Stefan_Lang26-Aug-11 2:05 
GeneralRe: Is memory leak possible when I dont delete the object Pin
manoharbalu26-Aug-11 2:33
manoharbalu26-Aug-11 2:33 
AnswerRe: Is memory leak possible when I dont delete the object Pin
richy_b28-Aug-11 10:27
richy_b28-Aug-11 10:27 
QuestionMFC's message map, no need of &? Pin
Dean Seo25-Aug-11 14:54
Dean Seo25-Aug-11 14:54 
It's syntax that we have to put '&' right before pointer to member function.
For example here.
C++
class Test;
typedef void (Test::*fpop)();
class Test
{
public:
	void Op1(){}
};

int main(){
	fpop pFunc;
	pFunc = &Test::Op1;   // we must need &

	return 0;
}


However, when I take a look at ON_COMMAND(or any other messages) in MFC, it seems a bit different from what I think is right.

VS6.0 is okay. It follows the right syntax as you see below.
You can clearly see & before memberFxn.
C++
#define ON_COMMAND(id, memberFxn) \
        { WM_COMMAND, CN_COMMAND, (WORD)id, (WORD)id, AfxSig_vv, (AFX_PMSG)&memberFxn },
                // ON_COMMAND(id, OnFoo) is the same as
                //   ON_CONTROL(0, id, OnFoo) or ON_BN_CLICKED(0, id, OnFoo)



But in VS2008, it goes a bit weird. There is no & before memberFxn.
C++
#define ON_COMMAND(id, memberFxn) \
        { WM_COMMAND, CN_COMMAND, (WORD)id, (WORD)id, AfxSigCmd_v, \
                static_cast<AFX_PMSG> (memberFxn) },
                // ON_COMMAND(id, OnBar) is the same as
                //   ON_CONTROL(0, id, OnBar) or ON_BN_CLICKED(0, id, OnBar)


Moreover, in spite of the fact that there is no & before memberFxn,
each line below works perfectly.

1. ON_COMMAND(ID_APP_ABOUT, CSingleApp::OnAppAbout) // &
2. ON_COMMAND(ID_APP_ABOUT, &CSingleApp::OnAppAbout) // no &

I tried to find why, and I was curious if it could be because of static_cast<> but it turned out that static_cast has nothing to do with it.

So I am wondering why in VS2008 I have 2 choices where I put & or I don't have to put &.
AnswerRe: MFC's message map, no need of &? Pin
Peter_in_278025-Aug-11 17:22
professionalPeter_in_278025-Aug-11 17:22 
GeneralRe: MFC's message map, no need of &? Pin
Dean Seo25-Aug-11 18:16
Dean Seo25-Aug-11 18:16 

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.