I'm trying to use the SendMessage for sending memory stream. I did some code, but not working. Here's my code.
Code
stream.Seek(0, SeekOrigin.Begin);Code
int dataSize = Convert.ToInt32(stream.Length);Code
byte[] byteArray = new byte[dataSize];Code
int count = stream.Read(byteArray, 0, 20);Code
while(count < stream.Length)Code
{Code
byteArray[count++] = Convert.ToByte(stream.ReadByte());Code
}Code
IntPtr ptrData = Marshal.AllocCoTaskMem(dataSize);Code
Marshal.Copy(byteArray, 0, ptrData, dataSize);Code
CopyDataStruct cds = new CopyDataStructCode
{Code
cbData = dataSize,Code
dwData = (IntPtr)1,Code
lpData = ptrDataCode
};Code
SendMessage(hWnd, WM_COPYDATA, 0, cds);Code
Code
Thanks
Answers
Know the answer? Post it. Somebody with the same question will find it here.