In Windows 7, I have an out of process COM server, say "MyComServer.exe". I register it as CLSCTX_LOCAL_SERVER
and REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED
.
In interactive sessions, session number > 0, only one instance of my MyComServer.exe runs, no matter how many clients are running. Say I'm running 5 excels, 3 matlabs and 7 others all using my COM server, I only see 1 MyComServer.exe running. This is fine, this is what I intended.
If several sessions are active, say sessions 1, 2 and 3 then I see 3 instances of MyComServer.exe. Using tasklist I can see each instance is running in a different session. This is fine as well, as I intended.
However, If I use it from session 0 I see an instance per client. Say I have 3 windows services all using it, then I see 3 instances of MyComServer.exe. Using tasklist I see all 3 of them run in session 0. Can processes in session 0 share an out of process COM server, please?
Investigation this issue I have noticed that PostMessage
doesn't work between processes in session 0. Reading the documentation I understand PostMessage
is not supposed to cross sessions, meaning a process in session 0 cannot post a message to a process in session 1. I have noticed that, while a process in session 1 can post a message to another process in the same session, a process in session 0 cannot post a message to any other process, even if the target is also running in session 0. Can someone please confirm this? It seems to be at odds with Microsoft documentation.
Thanks.