Controling Printer from a Program?

  • Thread starter Thread starter Jim Fuchs
  • Start date Start date
J

Jim Fuchs

I need to tell my printer to print pages 1-200, then 201-
400, then 401-600, etc. How can I control this via some
program code? (I'm a good FoxPro programmer). Thanks.
 
You probably can't control the *printer* from an application, but you could
very well might be able to control the *application* that's printing from
an application. Let's work with MS Word:

I'm going to assume that FoxPro can initiate a DDE conversation. Take a
look at http://msdn.microsoft.com and navigate to the following page:
MSDN Home
MSDN Library
Microsoft Office
Communicating with other applications

Then take note of the following registry key in your computer:
HKEY_C_R
Word.Document.8
Shell
Print

Under DDEEXEC, there's this conversation:
[REM _DDE_Minimize]
[FileOpen("%1")]
[t=IsDocumentDirty()]
[FilePrint 0]
[SetDocumentDirty t]
[DocClose]

The Print item on the context menu results in a command line equivalent of:
<path>/winword.exe /x <filename>

There's also PrintTo (just after Print) that has this additional DDE word:
[FilePrintSetup "%2 on p",.DoNotSetAsSysDefault=1]

I'm to take a wild guess that %2 is realized if a .DOC file object is
dropped on a printer object. But that's just a wild guess. (You're the
programmer. <grin>)

So there may be other DDE words, like FilePrintRange???

A Visual Basic statement *may* look like this (haven't tried it):

ActiveDocument.PrintOut _
Range:=wdPrintFromTo, From:="1", To:="5"
 
Back
Top