Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Once you have the name of a printer, to print on a network use the CopyFilefunction or the CreateFileand WriteFilefunctions.

To print using CopyFile
  1. Call CopyFile, specifying the network printer to use and which file to print.

  2. CopyFilehas the following syntax.

    Copy Code
    CopyFile (szSrcFile, szUNCPrinterShare, FALSE);
    
  3. The file to print is szSrcFile. The network printer to use is szUNCPrinterShare, which can accept a UNC name returned by the WNetEnumResourcefunction.

To print using CreateFile and Writefile
  1. Create a file on the network printer by calling CreateFile.

  2. Write the data or document to be printed to the newly created file by calling the WriteFilefunction.

  3. Close the fileto queue the print job.

See Also