Discussion Locked

Background printing in VB

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How to carryout a background printing process in VB?
Also I wanna know the no of printing processes running or some way to control the no. of print jobs at any moment to be exactly same as the no. of printers available at that time.

3 replies

by peter ritchie

Background printing (especially in VB) is complicated. Basically, you have to move your printing code to a background thread.

But, since that code can be running in the background you either have to lock down all the data that it's using as the basis for the print-out or make a copy of it all (a copy of the current "document"--which is what Word does). The first option is someone redundant because you end up locking the user out of the application while printing--defeating the purpose of background printing.

Checkout the Win32 API function CreateThread.

There's an MSJ article on multithreaded VB applications called "Ingenious ways to implement multiple threads in Visual Basic 5.0" that can be found at http://www.microsoft.com/MSJ/0897/multithreading.htm that may help you get started.

This discussion is closed to new replies.