If you have control over "that application" (e.g.Yahoo messenger), you can create a shared memory using winapi:
LPSECURITY_ATTRIBUTES lpAtt=NULL;
HANDLE INVALID_FILE_HANDLE=(HANDLE)0xFFFFFFFF; //Memory handle
hMapFile=::CreateFileMapping(INVALID_FILE_HANDLE,
lpAtt,PAGE_READWRITE, 0,nSize, SharedMemName);
if (hMapFile == NULL)
{
ShowSomeMessageBox("Could not create shared memory");
return NULL;
}
LPTSTR pBuf = (LPTSTR) MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS,0,0,nSize);
if(NULL==pBuf)
{
ShowSomeMessageBox("Could not create mapped view of theshared memory");
return NULL;
}
Once you have that buffer, you can write data to it using CopyMemory or whatever api.
In your C# application you can use InterOp (P-invoke) to call WinAPI:
Use:
OpenFileMapping(),MapViewOfFile()
etc. to open the shared memory
Use:
Marshal.ReadInt32(), Marshal.StructureToPtr()
etc to read the data to your C# data structures.