Link to home
Start Free TrialLog in
Avatar of alanjbrown
alanjbrown

asked on

How to ensure MsWord dialog boxes come to front when using Word via Automation

I am performing mail merges from Word XP controlled from Delphi using TwordApplication. Some of the word templates have dialog boxes to prompt the user for additional information during the merge. I have set wd1.visible := true, however on some occasions the word dialog goes behind the Delphi application, the user is not aware that word is waiting for his input and after a long wait the user closes the application in task manager.

How do I ensure that the dialog always is on top?

Thanks in anticipation.

Alan
ASKER CERTIFIED SOLUTION
Avatar of Russell Libby
Russell Libby
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alanjbrown
alanjbrown

ASKER

Thanks for the response.
I will not be able to try it untill tommorow as I am away from the office and don't have Delphi on my home PC. However what does OpusApp in FindWindow refer to?

Thanks
Alan

OpusApp refers the the window class that Microsoft for MS Word. (eg, the return value of GetClassName(hwnd, ...)).

Russell
Thanks, I understand now.

Will get back to you soon.

Alan
Russell

It appears to have done the trick. It has not gone wrong once during testing!

Thank you very much for the help. Sorry for the delay in responding.

Alan
No problem with the delay, glad it works well for you.

Russell