473,322 Members | 1,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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

Jan 16 '07 #1
2 1378
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.
Jan 16 '07 #2

make sure your COM object support multi-thread access (in 'MTA' model).

On Tue, 16 Jan 2007 16:18:31 +0800, unknown; <un*********@gmail.comwrote:
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
Jan 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
6
by: SamIAm | last post by:
Hi am creating a email application that needs to mail out a very large amount of emails. I have created a multithreaded c# application that using message queuing. I have created a threadpool of 5...
0
by: Vladimir Lushnikov | last post by:
Hi, I'm experimenting with the Seqpacket protocol, because the connectionless protocols aren't enough for my needs, and TCP/IP doesn't preserve message boundaries. This is what I've currently...
2
by: Markus Prediger | last post by:
Hi NG, I have an asp.net project that uses an vb6 com object for some database-manipulation (I cannot rewrite it in .net, sorry, its not my decision). I want it to be instanciated seperately...
11
by: mwt | last post by:
Hi. I'm reworking a little app I wrote, in order to separate the data from the UI. As a start, I wanted to create a iron-clad data recepticle that will hold all the important values, and stand up...
4
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Here is my problem. I have a program that will create a registry key, however it is not and here is the code and also the error that follows: ...
2
by: Thomas Ploch | last post by:
Hello folks, I am currently developing an open source Event Managment software (events in real-life, like concerts, exhibitions etc. :-) ) using wx for the GUI, and I need an Object database....
1
by: Abstract Labs | last post by:
We have recently deployed our application with the addition of AJAX.net for the last two weeks we have been suffering deadlock issues with the application pool. We are in a farmed environment and...
10
by: hofer | last post by:
Hi, I have multiple objects all belonging to the same class (which I didn't implement and whose code I don't want to modify) Now I'd like to change one method for one object only (after it has...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.