Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / October 2004

Tip: Looking for answers? Try searching our database.

dismiss a dialog box from a NON-INTERACTIVE service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alessio - 21 Sep 2004 14:07 GMT
Hi everybody,
I've been able to automate the mailmerge process with Microsoft
office 2003. Anyway, in some cases, it is still necessary to dismiss
an annoying dialog box unexpectedly shown by Word in the middle of the
whole process.
The application is able to dismiss the dialog box when the Word
automation server and the app itself run in the interactive desktop.
But when the app is started as a non-interactive service, it and the
word automation server are run in a different desktop, thus the dialog
box does not receive the keys sent by the app.
Anyone knows how to dismiss the dialog in this situation? I read
somewhere that any apps running in a non-interactive desktop don't
have the message queue, so it is useless to send them keyboard event
messages. So is it possible to make the app have its message queue? Or
is there any other way to make those dialogs be dismissed?

Thank you very much, and have a nice day
Alessio
Doug Robbins - 22 Sep 2004 00:10 GMT
What does the dialog box say?

If it's asking whether you want to print, use commands to execute the merge
to a new document, print the document then close it without saving it

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> Hi everybody,
> I've been able to automate the mailmerge process with Microsoft
[quoted text clipped - 14 lines]
> Thank you very much, and have a nice day
> Alessio
Alessio - 27 Sep 2004 10:25 GMT
Hello Doug,
thank you for your reply, but I already investigated the reasons why
this dialog box is shown, with Cindy Meister (see messages in this
newsgroup, subject: AVOIDING "Select Data Source" dialog box?!?;
date:2004-05-26 08:28:30 PST).
The conclusion was that I have to dismiss the dialog simulating the
user interaction with the dialog.
I have no problem when the application is running in the interactive
desktop, but when the application is running as a service (NOT
interacting with the desktop), then it seems that the dialog box
cannot receive any user input (it simply ignores the keyboard messages
sent by the application?!?)
So, the only thing I need to know now is whether there is any way to
dismiss such a dialog when it is shown by a word automation server run
from a service not interacting with the desktop.
please let me know if you have any suggestions about it.
Thank you
Alessio

> What does the dialog box say?
>
[quoted text clipped - 19 lines]
> > Thank you very much, and have a nice day
> > Alessio
Alessio - 01 Oct 2004 10:41 GMT
Dear all,
I've solved it, and it was even simpler than I imagined!
The "solution" that wasn't working (suggested by MSDN) used the
keybd_event() function to simulate the pressure and release of the ESC
key, with the dialog box window being active. But that didn't work,
since Windows did NOT send the corresponding messages to the active
window, since it was running in a non-interactive desktop.
So, the solution is to directly send those messages to the window
itself, by using the good, old SendMessage() API, sending both
WM_KEYDOWN and WM_KEYUP messages. This makes the window to actually
receive the messages, proving also that its message pump is alive and
kicking. Obviously, you have to know the window handle of the dialog,
but that's not a problem.
Besides, it appears that it is possible to (programmatically) interact
with a service not interacting with the desktop.
Bye,
> Hello Doug,
> thank you for your reply, but I already investigated the reasons why
[quoted text clipped - 38 lines]
> > > Thank you very much, and have a nice day
> > > Alessio
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.