Solved

B-I-G COM -problem

Posted on 2003-12-10
5
246 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Performance of SQL statement 37 128
How to convert memory stream to PDF file 6 128
Wincontrol not (correctly) drawn 15 42
Delphi problems to abort a printjob 9 25
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 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