Does the ATL COM object have a message pump?

If you create a new ATL project and add a simple COM object to it (note: an object, not a control) that uses the Threading Thread model, will the message pump work under the hood? I want to create a hidden window that is a member of my class of COM objects, but I'm not sure if any messages will really be sent or not. Is this being handled backstage or does it matter which application actually creates the COM object?

+3
source share
2 answers

No, the ATL COM object does not implement the default message pump. Your code must be used explicitly through the regular Windowing library or an explicit implementation of the message pump.

+4
source

COM uses a message pump under the hood to communicate with your COM object when necessary, if your COM object lives in an apartment. This is how methods are safely called on your object (by serializing messages in turn) when the object is called in another apartment (STA or MTA).

You cannot get to the message pump - COM unites for you only when necessary. You will notice that during debugging you call methods directly on your object - you do not jump through the message pump. Of course, you would be if you collected several objects that live in different apartments.

, . ATL Windows, CWindow CWindowImpl, .

0

Source: https://habr.com/ru/post/1721434/


All Articles