Home > Software engineering >  How to obtain a pointer?
How to obtain a pointer?

Time:01-08

A dialog box procedure, contains A, B, C of the dialog box, A is the main dialog box, BC is A child dialogs

When I need to get A pointer in the B when doing so, A * pDlg=(A *) AfxGetMainWnd ();

Now I want to get in B C pointer, what should I do?

C * pDlg=(C *)...

CodePudding user response:

 A * pDlg=new A ();//what is the difference between these two words? 

A * pDlg=(A *) AfxGetMainWnd ();

CodePudding user response:

reference 1st floor pc12138cwp response:
 A * pDlg=new A ();//what is the difference between these two words? 

A * pDlg=(A *) AfxGetMainWnd ();

The building Lord if there is not exposed, there are a lot of basic knowledge of recommend system first learning c + + language knowledge;

1, the differences between the two words is the second one is A pointer to the function for the main window call MFC (which is your main thread class CWinThread, members of the value of the m_pMainWnd is A pointer to the main window you previously set), and then cast to A pointer to A type of do A * (write);
2, the first sentence is directly created A type A, and the pDlg point to the new;
If you don't understand the basic knowledge of c + +, you should also won't go to learn MFC implementation of the framework, so one must look not to understand, 2 May also have difficulty, look, you look at the language, so you still learning libraries/frameworks,

CodePudding user response:

So ,,
  • Related