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