How do i print to a printer given a text in the edit box
Printable View
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'