![]() |
OnSetPreviewMode bug in VC2005 |
Post Reply
|
| Author | |
JonN
Newbie
Joined: 11 January 2004 Location: United Kingdom Status: Offline Points: 8 |
Post Options
Thanks(0)
Quote Reply
Topic: OnSetPreviewMode bug in VC2005Posted: 27 June 2006 at 9:07am |
|
I've just located a possible problem in the print preview sample for VC2005. Updating one of my programs from VC6 to VC2005, I discovered that the behaviour of OnSetPreviewMode has been altered slightly by Microsoft. The print preview MDI code sample (and my project) no longer hide command bars, docking panes or tab bars when print preview is selected. This seems to be due to the fact that OnSetPreviewMode in CMainFrame is no longer called by the framework. Searching through the code reveals that instead of the framework calling AfxGetMainWnd() to locate the parent frame, it now calls GetParentFrame() which of course finds the current active CMDIChildWnd.
As a workaround, I've added the following function to my CChildFrame class,
void CChildFrame::OnSetPreviewMode(BOOL bPreview, CPrintPreviewState* pState){
GetParentFrame()->OnSetPreviewMode(bPreview, pState); CMDIChildWnd::OnSetPreviewMode(bPreview, pState);
} This ensures that the parent CMainFrame class gets called. In addition the call to CMDIFrameWnd::OnSetPreviewMode(...) in CMainFrame::OnSetPreviewMode(...) should be removed, otherwise the program asserts. I'm sure there is a more elgant solution to this problem, but for now this works. |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |