Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Background Printing 1

Status
Not open for further replies.

siseas

Programmer
Sep 27, 2001
1
0
0
CR
Hi:

I have the following process:

Code #1....

Do Print_Invoice.prg

Code #2...

How can I run the Printing process into the Background. This is for avoid the delay time between "Code 1" and "Code 2".

Note: The PRG uses ??? comands to print text & values to the printer using SET PRINTER TO NAME Pos_Print

Thanks for any help.

 
I have only experimented a little with this in the past, so I don't have any evidence of which approach definitely works, or which works better.

Since the VFP UI is not multi-threaded, you need to create a separate process if you want to get any VFP action to happen in the background while other VFP stuff happens in the foreground.

There are (at least) two ways to create a separate process:
1) Launch a new copy of your EXE file (or a second, smaller EXE dedicated just to the background task), using a windows command (like ShellExecute)... using DO will not create a new process. The hard part here is passing the parameters to this second EXE... you could use command line parameters (somewhat limited), or a "control file" of an arbitrary format (unlimited, yet complicated to coordinate if there might be multiple background processes...).

2) Create a multi-threaded DLL in VFP that can handle the background process as an ActiveX method coll. Then, in the foreground process, instantiate your VFP-created ActiveX control using CREATEOBJECT(), and use method calls to give it the information it needs to commence the background printing. I'm not certain this'll work though: the VFP multi-threaded DLLs might require a multi-threaded ActiveX container... which, I believe, VFP is not.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Some links that may be useful:


Technical details on Multi-Threaded VFP DLLs: More discussion: A helper COM object:
Run Multiple VFP EXEs:

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top