dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Print Preview

  1. #1
    Join Date
    Oct 2011
    Posts
    97

    Print Preview

    Hi guys, I was hoping to get some advice on adding a printing and print preview functionality to my program. The software currently has printing functionality that works, and it has preview functionality that somewhat works on XP only. The thing is, all of the code was written 10 years ago in PowerBuilder and converted to VC++ recently, so it's all written from scratch. I was hoping to find a way that would take advantage of some built in Microsoft/MFC functionality to make it easier on me.

    Now, I've been searching for quite a while, and I've got a million ways to do it. Most recently, I found this DLL:

    http://www.codeproject.com/KB/printi...extension.aspx

    But, I don't know what the best way I should do it is, so I could use some advice.

    I have an MFC application build using VS2008 with the 2008 Feature Pack installed. I have maybe 10 classes that have to do printing and I don't mind re-writing the printing functions from scratch. I would also prefer that the print preview window be a dialog, but I could work with it being a child window as well.

    Anyway, I'm just at a loss of direction here. I don't know enough about it to know which is best, so hopefully you guys can give a few tips. Thanks in advance. I really appreciate this.

  2. #2
    Join Date
    May 2006
    Location
    Dresden, Germany
    Posts
    458

    Re: Print Preview

    Hi,

    I didn't have the time to read your link. But as an idea:

    To get to know how to do a print preview:
    Create a new project with the wizard, enable the print preview feature. Imlpement something (simple) to draw.
    Debug how the print preview stuff works there.
    Implement it similary in your project.

    If you've made your project "from the scratch" why didn't you use the print preview feature from the MFC wizzard created app?

    Regards
    PA

  3. #3
    Join Date
    Oct 2011
    Posts
    97

    Re: Print Preview

    Quote Originally Posted by ProgramArtist View Post
    Hi,

    I didn't have the time to read your link. But as an idea:

    To get to know how to do a print preview:
    Create a new project with the wizard, enable the print preview feature. Imlpement something (simple) to draw.
    Debug how the print preview stuff works there.
    Implement it similary in your project.

    If you've made your project "from the scratch" why didn't you use the print preview feature from the MFC wizzard created app?

    Regards
    PA
    Maybe I'm wrong here, but from what I understand, using the built in print preview requires the document/view framework, right? How do I add the doc/view framework to my app? Or does the app have to be built around that?

    Also, I didn't start this from scratch. This project is over 10 years old. I'm just picking up where the last guy left off.

  4. #4
    Join Date
    May 2006
    Location
    Dresden, Germany
    Posts
    458

    Re: Print Preview

    Quote Originally Posted by Access_Denied View Post
    Maybe I'm wrong here, but from what I understand, using the built in print preview requires the document/view framework, right? How do I add the doc/view framework to my app? Or does the app have to be built around that?
    No, you aren't wrong here.

    The built in preview feature of the MFC framework AFAIK depends from the doc/view style.
    But nevertheless you can create an "empty" new project using the wizzard and see (via debugging) what's going on there. Then you can use this knowledge in your app (either by copy/paste portions of the MFC code or by reimplementing it similarly).

    Quote Originally Posted by Access_Denied View Post
    Also, I didn't start this from scratch. This project is over 10 years old. I'm just picking up where the last guy left off.
    You wrote that you made things "from the scratch"; I quoted you here.
    And if you would have started from the scratch then using the built in preview feature could be the easiest way.

    In your case I think it is not possible to help you furthermore without having more info about your app.

    "it has preview functionality that somewhat works on XP only":
    What exactly happens in (which) other platforms?
    Did you debug your code?
    Did you get any assertions/errors/warnings?

    With regards
    PA

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)