Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Direct printing to a specific printer
Re: Direct printing to a specific printer [message #61857 is a reply to message #46435] Wed, 19 November 2025 13:09 Go to previous message
fzx374cn is currently offline  fzx374cn
Messages: 9
Registered: August 2025
Promising Member
Lance wrote on Wed, 11 May 2016 01:18
Turns out it's even easier. The following code succeeded on my windows 8 system.

{
	HDC hdc = CreateDC( "WINSPOOL", "Microsoft XPS Document Writer", NULL, NULL);

	if(hdc) {
		One<PrintDraw> d = new PrintDraw(hdc, "My Printing Job Name");
		LOG("Printer Draw OK");

		d->DrawText(10,20,"Test",StdFont().Height(720),Black());
		
		d->EndPage();

		DeleteDC(hdc);
	}
}


You should replace "Microsoft XPS..." with your actual printer name (who doesn't need to be the default printer.

HTH,

Lance

---------------------------------------------
U++, Ver 17810, Test ok, But need comment out "DeleteDC(hdc);"。
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to create new project (console/GUI/etc) using TheIDE?
Next Topic: New system of feature requests on our forums- please read and use!
Goto Forum:
  


Current Time: Sat Nov 29 07:42:47 CET 2025

Total time taken to generate the page: 0.06892 seconds