Printing from c++

J

John Evans

Hello folks.

I have designed a system in C++ 6.0 which manages sales and stock for my
company. Output from the system is in the form of .csv files. The user
needs to be able to print these .csv files (between 1 and 10 copies,
depending).

My problem is that I do not want the user to actually see the .csv file. So
I need the user to print documents directly from C++. I have tried using
the TPrintDialog, and using the TPrintDialog->Execute() command. But I do
not know how to send a document to a print job. I have also come across
BeginDoc() and EndDoc(), but on the whole I dont have a clue!

So how do you print a specific document directly from C++?

Any ideas would be great, thanks.

John
(e-mail address removed)
 
G

Gernot Frisch

John Evans said:
Hello folks.

I have designed a system in C++ 6.0 which manages sales and stock
for my
company. Output from the system is in the form of .csv files. The
user
needs to be able to print these .csv files (between 1 and 10 copies,
depending).

My problem is that I do not want the user to actually see the .csv
file. So
I need the user to print documents directly from C++. I have tried
using
the TPrintDialog, and using the TPrintDialog->Execute() command.
But I do
not know how to send a document to a print job. I have also come
across
BeginDoc() and EndDoc(), but on the whole I dont have a clue!

So how do you print a specific document directly from C++?

That's OT here. Try comp.ms-windows.programmer.win32
Tip: You can print it with the internet-explorer, right? Try:
WinExec("IExplorer /P " + filename, SW_HIDE);

HTH,
Genrot
 
K

Karl Heinz Buchegger

John said:
Hello folks.

I have designed a system in C++ 6.0 which manages sales and stock for my
company. Output from the system is in the form of .csv files. The user
needs to be able to print these .csv files (between 1 and 10 copies,
depending).

My problem is that I do not want the user to actually see the .csv file. So
I need the user to print documents directly from C++. I have tried using
the TPrintDialog, and using the TPrintDialog->Execute() command. But I do
not know how to send a document to a print job. I have also come across
BeginDoc() and EndDoc(), but on the whole I dont have a clue!

So how do you print a specific document directly from C++?

Any ideas would be great, thanks.

The short answer is: This is off topic in this group, since standard
C++ has no idea of a printer. Everything is done in streams. It might
be that your C++ system has a way of connecting a standard stream with
a printer. Often this is done by giving a file stream a special
filename, which is interpreted by the system as 'printer'.

The not so short answer is: Get a book about Windows programming.
Every book contains a section that deals with printers and how to
handle them.

The long answer is: In Windows all output is done through a device
context. So your real question is: How do I get a device context
connected to a printer? Once you have it, you draw on it like on
any other device context. When finished EndDoc() will do the rest.
Any Windows programming book explains that.
 
D

David T. Croft, Ph.D.

If you have MS you should have the on-line documentation. Look up device
context. For MFC CDC.

(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,181
Messages
2,570,970
Members
47,536
Latest member
VeldaYoung

Latest Threads

Top