CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd();