Solved

B-I-G COM -problem

Posted on 2003-12-10
5
243 Views
Last Modified: 2010-04-05
Hi all,

My Project has a big problem - we are using COM Components (ADO, MSXML) in a multithreaded application. As soon as we run the application on a multithreaded processor, it crashes. The MSDN says that we have to do some kind of proxy in order to use the MSXML in a multithreaded app. Can anyone please give me some hints on how to do this? Have anyone used COM in a multithreaded app?

cheers,

henrik
0
Comment
Question by:henrikatwork
5 Comments
 
LVL 2

Expert Comment

by:Robn
ID: 9922713
How are you calling CoInitialize?
Have you tried this...
CoInitializeEx(nil, COINIT_MULTITHREADED);
0
 
LVL 6

Expert Comment

by:bpana
ID: 9922968
listening ...
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 9926941
You need to CoInitialize in each thread.

And you can't just pass COM interface pointers between threads - they must be marshalled. Are you doing this?
0
 
LVL 1

Author Comment

by:henrikatwork
ID: 9928622
nope, how do I do the marshallening? I've never been doing that with Delphi, can you maybe give me an hint?

cheers,

henrik
0
 
LVL 12

Accepted Solution

by:
andrewjb earned 500 total points
ID: 9940999
Easiest way is to use CoMarshalInterThreadInterfaceInStream (what a function name!) which you can find documented in msdn, if nowhere else (just google!) Is that enough to get you going? The function is pretty obvious when you read it's description...
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now