Solved

saving location of CToolbarCtrl

Posted on 2007-03-29
1
411 Views
Last Modified: 2013-11-20
Hi,

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?

thanks
0
Comment
Question by:DJ_AM_Juicebox
1 Comment
 
LVL 9

Accepted Solution

by:
Priyesh earned 500 total points
ID: 18820978
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() ;
}

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now