How do i print to a printer given a text in the edit box
How do i print to a printer given a text in the edit box
WIN32 API or MFC/C++?
In WIN32 API.
Roughtly;
Get the printer/s with GetProfileString() or EnumPrinters() ect. Using the right PRINTER_INFO_# (1-5) depending on the OS ect.
Use PageSetupDlg() with a PAGESETUPDLG struc to allow the user to change the settings of the printer in the common dlgs (ensure that you have included/init common dlgs)
Get a HDC for the printer the user selected. (In the *DEVMODE struct.)
Send the StartDoc()
Send StartPage()
Print the data to the HDC of the printer. (TextOut())
Send the EndPage()
Send EndDoc()
Release the printer HDC.
Don't forget the AbortProc if the user wants to cancel the print.
Read Petzold's 'Prgramming Windows'
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill