Allan Fernandes
Allan Fernandes

Reputation: 121

Handle - Windows Service

How do I get the 'Handle' of the Windows Service, so as to pass Memory Mapped messages from a windows application. Both written in Delphi.

Upvotes: 0

Views: 529

Answers (1)

David Heffernan
David Heffernan

Reputation: 612993

The handle of the service is not what you need here. Memory mapped files are named kernel objects. So you need to agree on a name for your file mapping and use that to link your two processes.

When you call CreateFileMapping to create the file mapping, or open an existing file mapping created by the other process, you pass the name as the last argument. You'll need to use the Global\ namespace prefix to ensure that the file mapping is in the global namespace and so accessible from different sessions.

Memory mapped files are an unusual choice for IPC between service and desktop. One would more commonly expect to see named pipes or sockets.

Upvotes: 2

Related Questions