I would like to see C++ code in visual studio WIN PC that simply accepts a name (fo example) and prints it out on an attached (USB or WiFi) printer.

Jeff Knowles 0 Reputation points
2023-04-23T11:01:08.9433333+00:00

I wish to see if this is possible. I assume it must be possible to send the output to a printer (as well as screen or file). Yes, I am very new to C++ and visual studio.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,523 questions
Windows Server Printing
Windows Server Printing
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Printing: Printer centralized deployment and management, scan and fax resources management, and document services
658 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Limitless Technology 44,121 Reputation points
    2023-04-24T11:45:20.18+00:00

    Hello Thank you for your question and reaching out. I can understand you are having query\issues related to Printing in VC++. This below documents the Windows APIs that can be used to send raw data to a printer: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162959(v=vs.85).aspx This should be fine if you only want to print simple text. --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments

  2. Castorix31 83,206 Reputation points
    2023-04-25T07:29:17.1966667+00:00

    Use StartDoc, StartPage, etc.. like in the old KB : KB139652

    0 comments No comments

  3. Jeanine Zhang-MSFT 9,431 Reputation points Microsoft Vendor
    2023-04-25T09:12:20.8533333+00:00

    Hello,

    Welcome to Microsoft Q&A!

    I suggest you could start from the Doc: Documents and Printing

    You could refer to the samples:

    Sending GDI+ Output to a Printer

    Send raw data to a printer by using the Win32 API

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments