saving location of CToolbarCtrl


I have a toolbar ctrl. I'd like to save its position on the toolbar (or if the user decided to float it, it's position in space) to file or registry so I can restore its position next time the user starts up the application.

Do SaveState() and RestoreState() do that, or do I have to use GetWindowRect() / SetWindowRect() for that?

Who is Participating?
PriyeshConnect With a Mentor Commented:
In your CMainFrame class, in the OnCreate, right before the return, do this,

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
                     LoadBarState(_T("DockState")) ;
      return 0;

and to save, map the OnClose
void CMainFrame::OnClose()
      SaveBarState(_T("DockState")) ;
      __super::OnClose() ;

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.