SendKeys可以无需关注执行吗? [英] Can SendKeys execute without focus?

查看:88
本文介绍了SendKeys可以无需关注执行吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的想在不获得焦点的情况下使用SendKeys,但似乎不可能。实际上,我希望它能够在窗体最小化或不聚焦时输入AxShockwaveFlash对象。这可能与PostMessage或SendMessage或其他任何东西?

I really want to use SendKeys without getting focus, but it seems impossible. Actually, I want it to be able to type into the AxShockwaveFlash object while the form is minimized or not focused. Is this possible with PostMessage or SendMessage or anything?

推荐答案

如果您使用的Shockwave对象不提供任何公共控件引用,则可能无法实现迭代(或设置参考)。通常,您可以使用FindWindow / FindWindowEx获取窗口的句柄,然后使用PostMessage或SendMessage数据,但如果您想说,将文本注入SW控件中的某个文本框,则需要获取处理控件中的文本框。某些SW控件不允许这样做。这取决于SW控制它是否有效。此外,SendKeys 确实要求目标应用程序具有焦点,至少在您发送数据时是暂时的。

HTH,
This might not be possible if the Shockwave object you're using doesn't offer any public control references you can iterate through (or set a ref to). Normally, you can use FindWindow/FindWindowEx to get a handle to the window and then use either PostMessage or SendMessage data to it, but if you want to say, inject text into a certain text box in the SW control, you need to get a handle to the text box in the control.  Some SW controls don't allow that.  It depends on the SW control whether it will work or not.  Also, SendKeys does require the target app to have focus, at least temporarily while you're sending the data.

HTH,


这篇关于SendKeys可以无需关注执行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆