Click here to Skip to main content
15,914,642 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Excel automation from a worker thread Pin
led mike1-Feb-07 9:38
led mike1-Feb-07 9:38 
GeneralRe: Excel automation from a worker thread Pin
BuckBrown1-Feb-07 10:20
BuckBrown1-Feb-07 10:20 
GeneralRe: Excel automation from a worker thread Pin
CPallini1-Feb-07 10:39
mveCPallini1-Feb-07 10:39 
GeneralRe: Excel automation from a worker thread Pin
led mike1-Feb-07 11:07
led mike1-Feb-07 11:07 
GeneralRe: Excel automation from a worker thread Pin
BuckBrown1-Feb-07 12:10
BuckBrown1-Feb-07 12:10 
AnswerRe: Excel automation from a worker thread Pin
Jörgen Sigvardsson1-Feb-07 10:47
Jörgen Sigvardsson1-Feb-07 10:47 
GeneralRe: Excel automation from a worker thread Pin
BuckBrown1-Feb-07 12:09
BuckBrown1-Feb-07 12:09 
AnswerRe: Excel automation from a worker thread Pin
Roger Stoltz1-Feb-07 11:11
Roger Stoltz1-Feb-07 11:11 
In addition to Joergen's reply, you have to marshal your interface into the new apartment.

Spawning a worker thread and not initializing COM by calling ::CoInitialize[Ex](), is one of the top five mistakes when doing COM. Another one of the top five is using an interface gotten in the primary thread (apartment) without marshalling the interface. If you fail to do this you will get the RPC_E_WRONG_THREAD error.

Usually you marshal an interface by using ::CoMarshalThreadInterfaceInStream() and ::CoGetInterfaceAndReleaseStream().
Have a look here[^].

I think that by about 95% certainty, the above is your problem.


"It's supposed to be hard, otherwise anybody could do it!" - selfquote

GeneralRe: Excel automation from a worker thread Pin
BuckBrown1-Feb-07 12:10
BuckBrown1-Feb-07 12:10 
QuestionCommunicating dialog boxes Pin
kitty51-Feb-07 7:57
kitty51-Feb-07 7:57 
AnswerRe: Communicating dialog boxes Pin
led mike1-Feb-07 8:19
led mike1-Feb-07 8:19 
GeneralRe: Communicating dialog boxes [modified] Pin
kitty51-Feb-07 8:30
kitty51-Feb-07 8:30 
GeneralRe: Communicating dialog boxes Pin
led mike1-Feb-07 8:41
led mike1-Feb-07 8:41 
GeneralRe: Communicating dialog boxes Pin
kitty51-Feb-07 8:50
kitty51-Feb-07 8:50 
GeneralRe: Communicating dialog boxes Pin
led mike1-Feb-07 9:01
led mike1-Feb-07 9:01 
GeneralRe: Communicating dialog boxes Pin
Mark Salsbery1-Feb-07 11:39
Mark Salsbery1-Feb-07 11:39 
AnswerRe: Communicating dialog boxes Pin
Hamid_RT1-Feb-07 21:20
Hamid_RT1-Feb-07 21:20 
GeneralRe: Communicating dialog boxes Pin
kitty52-Feb-07 2:33
kitty52-Feb-07 2:33 
GeneralRe: Communicating dialog boxes Pin
Hamid_RT2-Feb-07 4:32
Hamid_RT2-Feb-07 4:32 
QuestionDeclaration of CSemaphore fails Pin
BuckBrown1-Feb-07 7:57
BuckBrown1-Feb-07 7:57 
AnswerRe: Declaration of CSemaphore fails Pin
led mike1-Feb-07 8:06
led mike1-Feb-07 8:06 
GeneralRe: Declaration of CSemaphore fails Pin
BuckBrown1-Feb-07 8:21
BuckBrown1-Feb-07 8:21 
GeneralRe: Declaration of CSemaphore fails Pin
led mike1-Feb-07 8:44
led mike1-Feb-07 8:44 
GeneralRe: Declaration of CSemaphore fails Pin
BuckBrown1-Feb-07 9:32
BuckBrown1-Feb-07 9:32 
GeneralRe: Declaration of CSemaphore fails Pin
Zac Howland1-Feb-07 9:31
Zac Howland1-Feb-07 9:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.