按下 Tab 时,Foxpro 托管的 Wpf 窗口将焦点返回到 Foxpro
我有一个 Visual FoxPro 9 应用程序,我使用 COM 互操作从中调用 wpf 窗口。第一次按下 TAB 时,焦点返回到 FoxPro 窗口。如果我回到 wpf 窗口,这种情况会再次发生,直到我第三次这样做,然后焦点才能正常工作。使用鼠标或 Alt+Tab 返回 wpf 窗口会发生这种情况。无论是否有焦点元素(文本框、日期选择器等),都会发生这种情况。 我曾尝试捕获窗口的PreviewKeyDown事件,但似乎在捕获它之前就发生了。我已经在 wpf 应用程序中测试了 wpf 窗口,它工作正常。
C Sharp 类就像:
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ProgId("SBN.WPF.Com")]
[ComVisible(true)]
public class WpfFoxPro
{
而 FoxPro 调用就像:
oDll = Createobjectex("SBN.WPF.Com", "", "")
oDll.VOpenWPFWindow()
我正在使用 Visual Studio 2010 和 .Net 4.0,但我已经没有想法了。有人知道这件事吗?
I have a Visual FoxPro 9 application from which I call a wpf window using COM interop. When TAB is pressed for the first time the focus goes back to the FoxPro window. If I come back to the wpf window this happens again until the third time I do it, and then the focus works normally. This occurs using the mouse or Alt+Tab to go back to the wpf window. It happens whether there is a focused element (textbox, datepicker,...) or not.
I have tried to capture the PreviewKeyDown event of the window, but it seems that it happens before it can capture it. I have tested the wpf window in a wpf application and it works ok.
The C Sharp class is like:
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ProgId("SBN.WPF.Com")]
[ComVisible(true)]
public class WpfFoxPro
{
and the FoxPro calls are like:
oDll = Createobjectex("SBN.WPF.Com", "", "")
oDll.VOpenWPFWindow()
I'm using Visual Studio 2010 and .Net 4.0 and I'm running out of ideas. Does any one know something about this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来可能很愚蠢,但是您可以在 WPF 窗口处于活动状态时禁用 VFP 窗口吗?这不是一个解决方案,但基于 10 年的 VFP 工作经验,有时您只需停止用头撞砖墙,而去拼凑。 ;)
Might sound stupid, but could you disable the VFP windows whilst the WPF one is active? It's not a solution, but based on 10 years of working with VFP, sometimes you just have to stop bashing your head against the brick wall and go for the kludge. ;)