
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
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