2

I have an MFC Feature Pack app with several toolbars (CMFCToolbar) whose positions are saved between sessions.

Now I've added a new toolbar, and I've moved some buttons from other toolbars to the new one.

The problem is that now, when I first open my app, all the toolbars appear badly misplaced (one over the menu bar, too many rows, etc). If I move them and close the application the state is correctly saved and retrieved in the next session.

I've stepped through the code and found that If I skip the call to CWinAppEx::LoadState() in CFrameImpl::OnLoadFrame() the bars are positioned at their "initial position", i.e. where they would appear in a fresh install. So the new toolbar, or the deleting of buttons from existing ones, is interfering with the load of the state.

So any ideas on how to load the state correctly? Or how to prevent the call to LoadState() only in the first execution?


Note: I think the problem might be similar to this other unanswered question of mine: MFC Feature Pack - How to add accelerators without deleting user's customization

Community
  • 1
  • 1
MikMik
  • 3,426
  • 2
  • 23
  • 41

0 Answers0