简体   繁体   English

使用ComfyJ将MS Word应用程序置于最前面

[英]Bring MS Word Application to the front using ComfyJ

I'm using ComfyJ 2.7 to try and open a new Word document in MS Word 2007 on Windows 7. I have been create the word document and save it but the application remains minimized in the task bar. 我正在使用ComfyJ 2.7尝试在Windows 7的MS Word 2007中打开一个新的Word文档。我已经创建了Word文档并保存了它,但是应用程序在任务栏中保持最小化。

I have tried using the following calls on the application to try and activate the window and bring it to the fore. 我尝试在应用程序上使用以下调用来尝试激活窗口并将其置于前台。

app.activate();
app.getActiveWindow().activate();
app.getActiveDocument().activate();

App.activate seems to make the application request that it move to the fore because the task bar item starts flashing, but it does not bring the word application to the fore. App.activate似乎使应用程序请求将其移到最前面,因为任务栏项开始闪烁,但它不会使单词application脱颖而出。

Has anyone been able to use comfyJ to successfully interop with MS Word? 有没有人能够使用comfyJ成功与MS Word互操作?

Have you tried the 您是否尝试过

 app.GetActiveDocument().ActiveWindow.WindowState

property? 属性?

if the taskbar just flashes, it sounds like maybe the document is being started minimized. 如果任务栏只是闪烁,听起来好像文件正在最小化。 You may just need to set windowstate to normal. 您可能只需要将windowstate设置为normal。

问题实际上是由Windows 7中的新焦点规则引起的。应用程序无法强制其他窗口成为焦点,它们只能通知他们想要焦点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM