[RESOLVED] printing files (or richTextBox in Forms)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [RESOLVED] printing files (or richTextBox in Forms)

  1. #1
    Join Date
    Feb 2007
    Posts
    43

    [RESOLVED] printing files (or richTextBox in Forms)

    Hi, guys.

    What I really want to do is to print a richTextBox from inside my app. However, after looking around, that looks like it will take about 100 lines of code, and I'd rather invest my time in adding other functionality.

    Question:
    If I save a temporary file, how can I print it from VC++ using windows rather than handling the print task within my app? (i.e. as though I'd right-clicked the file in windows and selected the "Print" option)

    Alternatively:
    Does someone have a good vc++ (i.e. non-VB) link for setting up a print document including rich text?

    Thanks in advance for your help.

  2. #2
    Join Date
    Feb 2007
    Posts
    43

    Re: printing files (or richTextBox in Forms)

    Found a workable solution, if anyone else has this same question.

    1) Save your richTextBox to a temp file.
    2) (Straight from msdn but a little hard to find)

    Code:
    Process^ myProcess = gcnew Process;
    myProcess->StartInfo->FileName = "...";  //... = path of the file
    myProcess->StartInfo->Verb = "Print";
    myProcess->StartInfo->CreateNoWindow = true;
    myProcess->Start();

Tags for this Thread

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center