MSWord COM Add-In. Default printing.

V

Vitalya

Hi all,
I write Word Add-In(C++).
I implement DocumentBeforePrint method to intercept document printing.
How can I check in this method that it was default printing - I mean that
user press print option on the context menu in Windows Explorer?
I want to know if print dialog have to be opened or printing will be
performed without dialog to defualt printer.
Thank in advance
 
C

Cindy M.

Hi Vitalya,
I write Word Add-In(C++).
I implement DocumentBeforePrint method to intercept document printing.
How can I check in this method that it was default printing - I mean that
user press print option on the context menu in Windows Explorer?
I want to know if print dialog have to be opened or printing will be
performed without dialog to defualt printer.

I think you'd have to use the Windows API to catch whether the Print (DDE)
command has been sent from within that interface. Word, itself, provides no
events or information like this. (And please note that a print job started
in Word can also be done without displaying the dialog box.)

The other thing that might help is to trap the DocumentOpen event in your
add-in. If that event fires, then BeforePrint fires for the same document
within a very short time span, you're probably not dealing with a document
that's being opened by a user.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
V

Vitalya

Thank you for your answer.
Can I differentiate print job started in word with dialog from print job
started in word without dialog.
 
C

Cindy M.

Hi Vitalya,
Can I differentiate print job started in word with dialog from print job
started in word without dialog.

Not as far as I know, if we're talking externally. Unless you can capture
display of the dialog box using the Windows API.

Internally (using VBA), I can capture the Word command (FilePrint vs
FilePrintDefault) by naming a procedure (Public Sub) with the same name as
the command.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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


Top