Calling AppActivate on a word 2007 window in Windows 7 gives it focus but doesn't bring it to top of stack

半腔热情 提交于 2019-12-25 02:25:44

问题


I'm trying to manipulate Word from an HTA file application. Currently, when I open word, it opens underneath my application. I'd like to open it on top. I've tried using the following JScript to give Word the focus:

wshShell = new ActiveXObject("WScript.Shell");
wshShell.AppActivate(doc.windows.Item(1).caption);

This works, and word gets focus, but on Windows 7 it stays underneath my app. Is there something else I need to do to bring word to the top?


回答1:


If you can't force that window to the front, send your own window to the back!

Try this:

<script>
window.blur();
</script>

That should send your current window to the background.



来源:https://stackoverflow.com/questions/3039165/calling-appactivate-on-a-word-2007-window-in-windows-7-gives-it-focus-but-doesn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!