CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Location
    Cary
    Posts
    12

    Print from Print Preview

    Does anyone know of a way to capture the message or event when the Print button is clicked from Print Preview in an SDI? This is necessary b/c I need to differentiate b/t File|Print and Print from Print Preview. Thanks in advance.

  2. #2
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354
    You could try changing the ID of the file menu print from ID_FILE_PRINT to something else.

  3. #3
    Join Date
    May 1999
    Location
    West Sussex, England
    Posts
    1,939
    This:

    void CPreviewView::OnPreviewPrint()
    {
    OnPreviewClose(); // force close of Preview

    // cause print (can be overridden by catching the command)
    CWnd* pMainWnd = AfxGetThread()->m_pMainWnd;
    ASSERT_VALID(pMainWnd);
    pMainWnd->SendMessage(WM_COMMAND, ID_FILE_PRINT);
    }

    is teh standard preview pane code for setting of the print from preview mode.

    So it looks like having a different menu option to handle the print would work correctly. All it needs to do is call straight through to OnFilePrint()
    Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
    Please remember to rate useful answers. It lets us know when a question has been answered.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured