Click here to Skip to main content
15,889,403 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: std::copy question Pin
Stuart Dootson3-Nov-09 23:40
professionalStuart Dootson3-Nov-09 23:40 
GeneralRe: std::copy question Pin
followait4-Nov-09 3:17
followait4-Nov-09 3:17 
QuestionHow to use WTL8 Wizard in VC6.0 ? Pin
wangningyu1-Nov-09 4:11
wangningyu1-Nov-09 4:11 
AnswerRe: How to use WTL8 Wizard in VC6.0 ? Pin
Stuart Dootson2-Nov-09 21:23
professionalStuart Dootson2-Nov-09 21:23 
GeneralRe: How to use WTL8 Wizard in VC6.0 ? Pin
wangningyu3-Nov-09 3:42
wangningyu3-Nov-09 3:42 
QuestionFiring a COM Event From Another Thread Pin
Rob Caldecott29-Oct-09 10:50
Rob Caldecott29-Oct-09 10:50 
AnswerRe: Firing a COM Event From Another Thread Pin
Lim Bio Liong1-Nov-09 23:53
Lim Bio Liong1-Nov-09 23:53 
AnswerRe: Firing a COM Event From Another Thread Pin
Roger Stoltz2-Nov-09 5:43
Roger Stoltz2-Nov-09 5:43 
As Lim Bio Liong already said, the problem is that the source interface, i.e. the interface that is called from your secondary thread, is not properly marshalled when crossing apartment boundaries.

Like you suggested yourself, you can post a message to the main thread and call the source interface from there.
But there are two other common ways when firing COM events from other threads:
1. Using ::CoMarshalInterThreadInterfaceInStream()[^] and ::CoGetInterfaceAndReleaseStream()
2. Using the Global Interface Table (GIT)

When the interface to be marshalled is a source interface, alternative #1 is useful if you know that all calls will be made from the thread that you've marshalled the interface into.
Alternative #2 is useful when you will be able to call the interface from any thread, or don't know what thread will make the call. But the downside is that it requires a little overhead compared to alternative #1 since you need to "get" the interface for every call.

Michael Lindig has written a very nice ATL solution that I've used for years which uses the GIT.
You'll find it here[^].


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown


AnswerRe: Firing a COM Event From Another Thread Pin
Lim Bio Liong2-Nov-09 18:50
Lim Bio Liong2-Nov-09 18:50 
QuestionCOM Instantiation. Pin
mh@markhoscik.plus.com29-Oct-09 4:50
mh@markhoscik.plus.com29-Oct-09 4:50 
QuestionHow to implement drived Interface using ATL? Pin
kcynic20-Oct-09 17:10
kcynic20-Oct-09 17:10 
AnswerRe: How to implement drived Interface using ATL? Pin
«_Superman_»21-Oct-09 11:47
professional«_Superman_»21-Oct-09 11:47 
GeneralRe: How to implement drived Interface using ATL? Pin
kcynic22-Oct-09 0:41
kcynic22-Oct-09 0:41 
GeneralRe: How to implement drived Interface using ATL? Pin
Lim Bio Liong4-Nov-09 18:30
Lim Bio Liong4-Nov-09 18:30 
GeneralRe: How to implement drived Interface using ATL? Pin
kcynic4-Nov-09 18:47
kcynic4-Nov-09 18:47 
GeneralRe: How to implement drived Interface using ATL? Pin
Lim Bio Liong4-Nov-09 18:50
Lim Bio Liong4-Nov-09 18:50 
GeneralRe: How to implement drived Interface using ATL? Pin
kcynic4-Nov-09 18:58
kcynic4-Nov-09 18:58 
GeneralRe: How to implement drived Interface using ATL? Pin
Lim Bio Liong4-Nov-09 19:04
Lim Bio Liong4-Nov-09 19:04 
GeneralRe: How to implement drived Interface using ATL? Pin
kcynic4-Nov-09 19:15
kcynic4-Nov-09 19:15 
GeneralRe: How to implement drived Interface using ATL? Pin
Lim Bio Liong4-Nov-09 19:18
Lim Bio Liong4-Nov-09 19:18 
GeneralRe: How to implement drived Interface using ATL? Pin
kcynic4-Nov-09 19:46
kcynic4-Nov-09 19:46 
QuestionIs there any code library available for developing BHOs? Pin
Ziink9-Oct-09 10:44
Ziink9-Oct-09 10:44 
AnswerRe: Is there any code library available for developing BHOs? Pin
«_Superman_»10-Oct-09 10:36
professional«_Superman_»10-Oct-09 10:36 
Questionhow do i change the color of a rebar? Pin
Nicolai M3-Oct-09 3:04
Nicolai M3-Oct-09 3:04 
AnswerRe: how do i change the color of a rebar? Pin
Michael Dunn13-Oct-09 8:30
sitebuilderMichael Dunn13-Oct-09 8:30 

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.