如何在wpf应用程序中添加com对象 [英] how to add com objects in wpf application

查看:168
本文介绍了如何在wpf应用程序中添加com对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个com对象,可以在Windows窗体应用程序中正常工作.但不能在wpf应用程序中使用.当我添加对象时,调用com对象中的任何方法时,它都会给ocxstate异常.

I have a com object which is working fine with windows form application. but not working in wpf application. when i add the object it giving ocxstate exception when calling any method in the com object

推荐答案

这可能与WPF使用的线程模型有关.我们需要查看错误才能有机会知道.一种解决方法可能是在winforms中创建一个控件,然后在WPF中托管该控件.
It could be an issue to do with the threading model that WPF uses. We''d need to see the error to have a chance at knowing. One work around might be to create a control in winforms, and then host that control in WPF.


这篇关于如何在wpf应用程序中添加com对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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