![]() |
create a COM object which supports threading
hello,
i've two projects. One is a (native) C++ project building as a COM. the other one is a VB.NEt project which will use the COM object. both are written in Visual Studio 2005 when i call in VB.NET a function in C++ it all works fine. but this function will take about 1 or 2 minutes and in the mean time i want to access some properties (from the same COM object). I thought i could fix this with a thread in VB.NET ending up with something like this. ( i know this is VB.NET code, but it's only to explain my problem) 1) Dim a As COMLib.IcomClass = New COMLib.comClass 2) Dim t As Thread 3) t = New Thread(AddressOf a.functionIwantToCall) 4) t.Start() 5) dim i as integer 6) i = a.integerProperty when i start my thread (4) this will work. my COM function will execute but when this thread was started my application will not execute 5 and 6 till the COM function is finished. i think this is because VB.NET can't execute a part of the function because it isn't a real part of my VB.NET application my question: how do i make a COM object which will support threading? or how do i solve this problem? thank you |
Re: create a COM object which supports threading
unknown; wrote:
> hello, > > i've two projects. One is a (native) C++ project building as a COM. > the other one is a VB.NEt project which will use the COM object. > Off topic here, try a windows programming group. -- Ian Collins. |
Re: create a COM object which supports threading
make sure your COM object support multi-thread access (in 'MTA' model). On Tue, 16 Jan 2007 16:18:31 +0800, unknown; <unknown1310@gmail.com> wrote: > hello, > > i've two projects. One is a (native) C++ project building as a COM. > the other one is a VB.NEt project which will use the COM object. > > both are written in Visual Studio 2005 > > > when i call in VB.NET a function in C++ it all works fine. but this > function will take about 1 or 2 minutes and in the mean time i want to > access some properties (from the same COM object). > > I thought i could fix this with a thread in VB.NET ending up with > something like this. > ( i know this is VB.NET code, but it's only to explain my problem) > > 1) Dim a As COMLib.IcomClass = New COMLib.comClass > 2) Dim t As Thread > 3) t = New Thread(AddressOf a.functionIwantToCall) > 4) t.Start() > 5) dim i as integer > 6) i = a.integerProperty > > when i start my thread (4) this will work. my COM function will execute > but when this thread was started my application will not execute 5 and > 6 till the COM function is finished. i think this is because VB.NET > can't execute a part of the function because it isn't a real part of my > VB.NET application > > my question: how do i make a COM object which will support threading? > or how do i solve this problem? > > thank you > |
| All times are GMT. The time now is 09:07 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.