Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Printing How?

Printing How?

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wow9999
    wrote on last edited by
    #1

    Hi all I create a file by using CStdioFile. I want to sent this file to Printer, which function should i use? Thanks

    H 1 Reply Last reply
    0
    • W wow9999

      Hi all I create a file by using CStdioFile. I want to sent this file to Printer, which function should i use? Thanks

      H Offline
      H Offline
      HPSI
      wrote on last edited by
      #2
      1. Use ShellExecute()

        ShellExecute(m\_hWnd, "print", "MyFile.txt", NULL, NULL, SW\_HIDE);
        

        This will execute the program associated with the .txt extension and tell it to print the file.

      2. Use system()

        system("copy "MyFile.txt" lpt1:");
        

        This will send the file to the printer using the DOS copy command. Note that the last (partial) page will probably not be printed, unless you send a formfeed.

      3. Use MFC's doc/view printing architecture. See the Printing section here on CP for more details.

      HPS HwndSpy - GUI developer's aid to visually locate and inspect windows. For the month of August only, use coupon code CP-81239 for 30% off.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups