Print Preview Issue

Hey,

Heres the problem.  I use the OnFilePrintPreview and OnEndPrintPreview methods of the various views.  I have overridden these methods just for some appilication specific calls, but at the end of that i still call the base class for these methods.  That all works well but when I preview a document and then open another document it fails,  basically i want to be able to call the OnEndPrintPreview method when i open a new document (just in case) but dont know what the message call is can you help

Thanks

Will


Answer this question

Print Preview Issue

  • Tanya R. - MSFT

    Ok, I see what your thinking, i have tried several ways to implement this and failed each time.

    CFrame::GetActiveView() What do i set this equal to   A CView  

    The "DYNAMIC_DOWNCAST".  This refers to a class and a pointer, I'm guessing that the pointer is the CPreviewView   So whats the class

    And the OnPreviewClose method, i have looked at that in the developer site but it seems to come under Visual fox pro   I'm using C++   If this is a method that can be used in C++ then how is it called   Stumped on nearly all of this


    Thanks for your help

    Will

  • SnowLover

    Thanks

    I've gotten it working now, I couldnt seem to get the DYNAMIC_DOWNCAST to work, it always seemed to return null no matter what.  I got round this using a flag,

    Thanks v. much for your help


    Will


  • KrazyKevin

    have tried the pView->OnPreviewClose, as well as using a number of other view pointers, but the method appears to be protected, how can i access it

    Will

  • Joshua Sells

    Doooh.. OK just saw the class and its methods. Sorry

    OK must be easier.
    Just do the following
    AfxGetMainWnd()->SendMessage(WM_COMMAND,AFX_ID_PREVIEW_CLOSE);
    Should work.



  • Scott21

    its MDI, what should i use for that

    Thanks

    Will


  • OHDev

    CFrame::GetActiveView is the function to retrieve the current active View from a frame! So if you have an SDI application you can get the current active View!

    When the preview View is active your current View class is replaced by a CPreviewView object.
    So in short:
    DYNAMIC_DOWNCAST(CPreviewView,pView) should return a pointer to the CPreviewView class object.

    OnPreviewClose is no documented function. It is the implementation of the for the handler when the user presses the Close button in the preview. 

    Is this application MDI or SDI



  • Pradeep Raj

    There is a post earlier on which it says its MDI, whats the script sample do u have a link

    Thanks

    Will


  • Sacristy

    The MSDN Scribble tutorial. For me a standard sample to check MFC behaviour.

    http://msdn.microsoft.com/library/en-us/vcsample/html/_sample_mfc_scribble.asp

  • sieler

    Ok i have got it working using CMDIFrameWnd::GetActiveView

    But when i come to use the OnPreviewClose, I am confused as to how to use it   Are we talking just the call ie.

    OnPreviewClose():
    or via the pView pointer

    pView->OnPreviewClose();

    Or something entirely different

    Thanks for your help with this

    Will

  • Mishkina

    Get the parent frame window and the active view with CFrameWnd::GetActiveView, cast this into a CPreviewView with DYNAMIC_DOWNCAST, if the pointer is non NULL call  OnPreviewClose

  • Edward V. Wright

    One thing i have noticed tho...the new document is loaded succesfully etc, but when you got to exit that document or minimise it the other document (window) underneath, that was previously in print preview mode is displayed without the minimise, maximise, close (X) icons that your normally have in the top right hand corner of a window.  Once you maximise that window or document the icons in the top right appear and stay with it, any ideas   Is there a way to force the showing of these icons and how would I specify that for this particular window


    Thanks

    Will

  • Anujpathania

    I asked it but never get an answer
    MDI or SDI It just guess and say MDI!

    I just checked this with the scribble sample and it does not show this behaviour.



  • Print Preview Issue