Page 1 of 1

Using INamedBuffer

Posted: Thu Oct 02, 2008 1:22 pm
by Cristian
Hi all,

I'm new in madshi!!
I have to say that is a great library!
But not very good documented, at least in some parts.

I'm developing a windows service, and I have created a monitor application to receive status information and interact with that service.

I think the best way to do this is by using INamedBuffer.
However I cant figure out how to use that interface.
I can create it, but how can I read/write to that buffer?
Can the read function be blocking and/or non-blocking?

Thanks for the tips!!

Cristian

Posted: Wed Oct 08, 2008 8:45 pm
by madshi
Hello,

INamedBuffer is just a simple encapsulation of the win32 APIs Create/OpenFileMapping, (Un)MapViewOfFile and CloseHandle.

Basically you can create a "shared" memory area this way to which all of your processes can write. "INamedBuffer.Memory" returns a point to the shared buffer. You can use the pointer for reading from or writing to the buffer. Reading/writing does not block. You can realize something like that yourself by making use of a named mutex or semaphore.

Alternatively you could also check out madCodeHook which contains direct IPC functions for communication between different processes. madCodeHook licensing is quite restricted, though.