Seasonal difference: getParentFrame and AFXGETMAINWND view

xiaoxiao2021-03-06  84

Seasonal difference: GetParentFrame and AFXGetMainwnd in the view.

The following code: // ((cmainframe *) getParentFrame ()) -> setStatusBarpositionText (12, 122); // cmainframe * PMAINFRAME = (CMAINFRAME *) (AFXGetApp () -> m_pmainwnd);

CMainFrame * pMainFrame = (CMainFrame *) AfxGetMainWnd (); pMainFrame-> m_wndStatusBar.SetPaneText (2, "abc"); // ((CMainFrame *) GetParentFrame ()) -> m_wndStatusBar.SetPaneText (2, "abc");

If you have never get Statusbar with getParentFrame. If you are, getParentFrame returns CWnd *, and this pointer points to the CFrameWnd object, not our CMAINFRAME object, only CMAINFRAME has STATUSBAR members.

转载请注明原文地址:https://www.9cbs.com/read-121868.html

New Post(0)