Application Persistance
Chris Eaton -- eatonc@srnet.com Thursday, July 25, 1996 Environment: Windows NT 3.51 VC++ 4.1 I am trying to add Window size and location Persistance(Save and Restore) from the Registry to an MDI application. I have a CFrameWnd derived class that overrides ActivateFrame and handles WM_DESTROY for doing the Read & Write ProfileStrings. What is the preferred way to handle this for MDI? Anyone know of a good sample to look at? thanks chris
Roger Onslow -- Roger_Onslow@compsys.com.au Monday, July 29, 1996 [Mini-digest: 3 responses] >I am trying to add Window size and location Persistance(Save and >Restore) from the Registry to an MDI application. If you have MSDN (or access to MSJ issues) look at articles C/C++ Q&A December 1995 (Number 12) and an update on this in C/C++ Q&A March 1996 (Number 3) Which show how to save/resorce child window size and position in an MDI app (don't forget to read the update at the end of the march edition) -----From: "Dean Grimm"The following works for me: CMainFrame::CMainFrame() { m_bStartup=TRUE; } void CMainFrame::ActivateFrame(int nCmdShow) { if (!m_bStartup) { CMDIFrameWnd::ActivateFrame(nCmdShow); return; } m_bStartup = FALSE; WINDOWPLACEMENT wp; GetWindowPlacement(&wp); // read position from registry into wp.rcNormalPosition . . wp.showCmd = nCmdShow; SetWindowPlacement(&wp); } void CMainFrame::OnClose() { WINDOWPLACEMENT wp; GetWindowPlacement(&wp); // write wp.rcNormalPosition to registry . . CMDIFrameWnd::OnClose(); } BOOL CDppApp::InitInstance() { . . if (!ProcessShellCommand(cmdInfo)) return FALSE; pMainFrame->ShowWindow(SW_HIDE); pMainFrame->ActivateFrame(m_nCmdShow); return TRUE; } Hope this helps, Dean ========================================================== Dean Grimm Software Engineer / Cortron corp. -----From: Alexandre de Brito Nobre The book "Inside Visual C++", by David J. Kruglinski (Microsoft Press) has an excelent (and easy) example to do what you want.
| Вернуться в корень Архива |