Hi,
I'm trying to use the SendMessage for sending memory stream. I did some code, but not working. Here's my code
Thanks
I'm trying to use the SendMessage for sending memory stream. I did some code, but not working. Here's my code
C#:
st[COLOR=#333333]ream.Seek(0, SeekOrigin.Begin);
[/COLOR][COLOR=#333333]int dataSize = Convert.ToInt32(stream.Length);
[/COLOR][COLOR=#333333]byte[] byteArray = new byte[dataSize];
[/COLOR][COLOR=#333333]int count = stream.Read(byteArray, 0, 20);
[/COLOR][COLOR=#333333]while(count < stream.Length)
[/COLOR][COLOR=#333333]{
[/COLOR][COLOR=#333333]byteArray[count++] = Convert.ToByte(stream.ReadByte());
[/COLOR][COLOR=#333333]}
[/COLOR][COLOR=#333333]IntPtr ptrData = Marshal.AllocCoTaskMem(dataSize);
[/COLOR][COLOR=#333333]Marshal.Copy(byteArray, 0, ptrData, dataSize);
[/COLOR][COLOR=#333333]CopyDataStruct cds = new CopyDataStruct
[/COLOR][COLOR=#333333]{
[/COLOR][COLOR=#333333]cbData = dataSize,
[/COLOR][COLOR=#333333]dwData = (IntPtr)1,
[/COLOR][COLOR=#333333]lpData = ptrData
[/COLOR][COLOR=#333333]};
[/COLOR][COLOR=#333333]SendMessage(hWnd, WM_COPYDATA, 0, cds);[/COLOR]
Thanks