Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 802
  • Last Modified:

Conversion from SingleThread to MultiThread cause CoCreateInstance to fail

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
Sharonz
Asked:
Sharonz
1 Solution
 
jimbucciCommented:
Try setting ThreadingModel = Both
0
 
SharonzAuthor Commented:
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
 
jimbucciCommented:
excellent.
0
 
griesshCommented:
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
 
MindphaserCommented:
Points refunded and moved to PAQ

** Mindphaser - Community Support Moderator **
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now