COM和线程 [英] COM and Threads

查看:73
本文介绍了COM和线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它使用COM的Dispatch来创建一个基于COM的

对象。现在我需要将应用程序升级为线程应用程序。但

它给出了一个COM和线程不会一起出错的错误。特别是
在调用COM对象时的属性错误。任何

指针请??????

解决方案

Teja写道:
< blockquote class =post_quotes>
我有一个应用程序,它使用COM的Dispatch来创建一个基于COM的

对象。现在我需要将应用程序升级为线程应用程序。但

它给出了一个COM和线程不会一起出错的错误。特别是
在调用COM对象时的属性错误。任何

指针请??????



如果COM不是线程安全的,那么使用进程




hg写道:


Teja写道:


我有一个应用程序,它使用COM的Dispatch来创建一个基于COM的

对象。现在我需要将应用程序升级为线程应用程序。但

它给出了一个COM和线程不会一起出错的错误。特别是
在调用COM对象时的属性错误。任何

指针请??????



如果COM不是线程安全的,那么使用进程



多谢你的回复.. ....请你告诉我如何处理
流程......




Teja < te ********* @ gmail.comwrote:


>我有一个使用COM的Dispatch创建COM的应用程序基于

对象。现在我需要将应用程序升级为线程应用程序。但

它给出了一个COM和线程不会一起出错的错误。特别是
在调用COM对象时的属性错误。任何

指针请??????



实际回溯会有所帮助。

猜测,当在一个线程中使用COM

时,你需要调用pythoncom.CoInitialize和

CoUninitialize your。


Roger


I have an application which uses COM ''s Dispatch to create a COM based
object. Now I need to upgrade the application to a threaded one. But
its giving an error that COM and threads wont go together. Specifically
its an attribute error at the point where COM object is invoked. Any
pointers please??????

解决方案

Teja wrote:

I have an application which uses COM ''s Dispatch to create a COM based
object. Now I need to upgrade the application to a threaded one. But
its giving an error that COM and threads wont go together. Specifically
its an attribute error at the point where COM object is invoked. Any
pointers please??????

If COM is not thread safe, then use processes



hg wrote:

Teja wrote:

I have an application which uses COM ''s Dispatch to create a COM based
object. Now I need to upgrade the application to a threaded one. But
its giving an error that COM and threads wont go together. Specifically
its an attribute error at the point where COM object is invoked. Any
pointers please??????


If COM is not thread safe, then use processes

Thanks a LOT for your reply...... Can u please tell me how to
processes......



"Teja" <te*********@gmail.comwrote:

>I have an application which uses COM ''s Dispatch to create a COM based
object. Now I need to upgrade the application to a threaded one. But
its giving an error that COM and threads wont go together. Specifically
its an attribute error at the point where COM object is invoked. Any
pointers please??????

An actual traceback would help.
At a guess, when using COM in a thread
you need to call pythoncom.CoInitialize and
CoUninitialize yourself.

Roger


这篇关于COM和线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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