开发者

Foxpro hosted Wpf window return focus to foxpro when Tab is pressed

开发者 https://www.devze.com 2023-03-27 07:33 出处:网络
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

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 mous开发者_如何学编程e 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?


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. ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号