Solved

Conversion from SingleThread to MultiThread cause CoCreateInstance to fail

Posted on 2002-06-05
5
779 Views
Last Modified: 2012-06-21
I convert my com Out-Proc project from CComSingleThreadModel to be CComMultiThreadModel.
(ThreadingModel = Free).
This out-proc calls an in-proc project (multiThreaded as well), this in-proc tries to CoCreateInstance of ShellLink interface.
Since the conversion the CoCreateInstance of ShellLink interface failed, the error I recieve is -2147467262 ("no such interface supported").
(Just for testing, I make my out-proc to be a SingleThreaded again and it worked fine).
What should I do to make it work in MultiThreaded as well ?
0
Comment
Question by:Sharonz
5 Comments
 
LVL 3

Expert Comment

by:jimbucci
ID: 7107224
Try setting ThreadingModel = Both
0
 

Author Comment

by:Sharonz
ID: 7107440
Thanks for your answer.
I solved it already, but in a different way.
I found out that current versions of shell32 do not contain marshaling information for shell interfaces such as IShellLink. Without the marshaling information, COM
cannot make method calls in shell interfaces in a multithreaded apartment.
I solved it by creating a new In-Proc project SingleThreadModel that create the ShellLink for my Out-Proc project (the MultiThreaded one).
0
 
LVL 3

Expert Comment

by:jimbucci
ID: 7107496
excellent.
0
 
LVL 11

Expert Comment

by:griessh
ID: 7261486
Dear Sharonz

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to

     "refund the points and PAQ at 0 points"

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 7332884
Points refunded and moved to PAQ

** Mindphaser - Community Support Moderator **
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

757 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

16 Experts available now in Live!

Get 1:1 Help Now