Learn MFC before I took a look at the basic knowledge of c + +, we typically see in c + + function form is such a
Class A {
...//member functions and data members
};
Int main () {
A, A.
return 1;
}
Are generally in this form, when we create A class, does not occupy memory space, only after the class is instantiated memory space, also A have this sentence is A object A will take up memory space,
But in MFC, I built a project, and then set up step by step, at the same time, the middle one step I checked is based on the dialog box, after setting, system will automatically generate a main dialog box, and then on the left is an app. CPP and a DLG. CPP, there are various. H file and some resource file, I write programs are * * * DLG. CPP to add all kinds of code, that is to say, I just in this kind of * * * DLG for various operation,
I doubt who system generated when the dialog is created, I think should have a similar to the above such a * * * DLG; Code to create dialog, otherwise how to generate the dialog box, lead me in the morning of a problem, I am in the class in a static function to access a non-static function, I will need to use the object name. Functions such access, but the main dialog box I don't know who is created, how do I use the object name to access and use professional terms is to obtain the meaning of the pointer to the parent window,
Say so many, do not know to have understand, still hope the great god glad to try to speak the full
CodePudding user response:
"Who is this dialog system generated created" dialog main dialog is created by the MFC project, with the CWnd * AfxGetMainWnd ();Get
CodePudding user response:
TheCxxxDlg * pDlg=(CxxxDlg *) AfxGetMainWnd ();
CodePudding user response:
App based on dialog, pay attention to the App class InitInstanceCodePudding user response:
"I think that there is a similar to the above such a * * * DLG;" Your understanding is correct, just didn't find a place to see,This thing on the App have code in your InitInstance function embodied in the class
CodePudding user response:
see MFC automatically created app DLG that a few classesCodePudding user response:
System guide to help you createCodePudding user response:
Look at your App InitInstance function of a class ~CodePudding user response: