Click here to Skip to main content
15,885,767 members
Home / Discussions / C#
   

C#

 
SuggestionRe: Manually linking in references Pin
maverick199115-Jul-16 22:30
professionalmaverick199115-Jul-16 22:30 
QuestionPassing Memory Stream between C# Windows Pin
sunsher14-Jul-16 18:02
sunsher14-Jul-16 18:02 
AnswerRe: Passing Memory Stream between C# Windows Pin
Mycroft Holmes14-Jul-16 20:11
professionalMycroft Holmes14-Jul-16 20:11 
AnswerRe: Passing Memory Stream between C# Windows Pin
Pete O'Hanlon14-Jul-16 20:46
mvePete O'Hanlon14-Jul-16 20:46 
GeneralRe: Passing Memory Stream between C# Windows Pin
sunsher17-Jul-16 13:04
sunsher17-Jul-16 13:04 
GeneralRe: Passing Memory Stream between C# Windows Pin
Pete O'Hanlon17-Jul-16 21:12
mvePete O'Hanlon17-Jul-16 21:12 
GeneralRe: Passing Memory Stream between C# Windows Pin
sunsher18-Jul-16 13:01
sunsher18-Jul-16 13:01 
GeneralRe: Passing Memory Stream between C# Windows Pin
sunsher18-Jul-16 13:55
sunsher18-Jul-16 13:55 
This did work!

C#
MemoryStream ms = new MemoryStream();
            using (ms = GetMemoryStream())
            {
                ms = new MemoryStream(ms.ToArray());

                COPYDATASTRUCT cds;
                cds.dwData = 0;
                cds.lpData = IntPtr.Zero;
                cds.cbData = 0;

                try
                {
                    ms.Flush();
                    ms.Position = 0;
                    
                    int hWnd = FindWindow(null, "Receive");
                    int dataSize = Convert.ToInt32(ms.Length);

                    cds.dwData = 0;
                    cds.lpData = Marshal.AllocCoTaskMem(dataSize);
                    cds.cbData = dataSize;

                    SendMessage(hWnd, WM_COPYDATA, 0, ref cds);
                }
                finally
                {
                    Marshal.FreeCoTaskMem(cds.lpData);
                    ms.Close();
                }
            }


But I think I'm not passing the memory stream to the other application. I declared the dwData as Memory Stream. Am I doing right?
GeneralRe: Passing Memory Stream between C# Windows Pin
sunsher18-Jul-16 15:17
sunsher18-Jul-16 15:17 
QuestionLifo and Fifo Pin
Member 1116162514-Jul-16 17:53
Member 1116162514-Jul-16 17:53 
AnswerRe: Lifo and Fifo Pin
Mycroft Holmes14-Jul-16 20:13
professionalMycroft Holmes14-Jul-16 20:13 
AnswerRe: Lifo and Fifo Pin
Richard MacCutchan14-Jul-16 21:42
mveRichard MacCutchan14-Jul-16 21:42 
QuestionReflection problem Pin
Super Lloyd14-Jul-16 4:08
Super Lloyd14-Jul-16 4:08 
AnswerRe: Reflection problem Pin
Kenneth Haugland14-Jul-16 4:27
mvaKenneth Haugland14-Jul-16 4:27 
GeneralRe: Reflection problem Pin
Super Lloyd14-Jul-16 4:52
Super Lloyd14-Jul-16 4:52 
GeneralRe: Reflection problem Pin
Kenneth Haugland14-Jul-16 5:24
mvaKenneth Haugland14-Jul-16 5:24 
GeneralRe: Reflection problem Pin
Super Lloyd14-Jul-16 5:27
Super Lloyd14-Jul-16 5:27 
SuggestionRe: Reflection problem Pin
Richard Deeming14-Jul-16 4:41
mveRichard Deeming14-Jul-16 4:41 
GeneralRe: Reflection problem Pin
Super Lloyd14-Jul-16 4:52
Super Lloyd14-Jul-16 4:52 
GeneralRe: Reflection problem Pin
Super Lloyd14-Jul-16 4:54
Super Lloyd14-Jul-16 4:54 
JokeNo overload for method 'PassStructIn' takes 4 arguments Pin
Member 1224497214-Jul-16 4:03
Member 1224497214-Jul-16 4:03 
GeneralRe: No overload for method 'PassStructIn' takes 4 arguments Pin
Eddy Vluggen14-Jul-16 4:05
professionalEddy Vluggen14-Jul-16 4:05 
GeneralRe: No overload for method 'PassStructIn' takes 4 arguments Pin
OriginalGriff14-Jul-16 4:32
mveOriginalGriff14-Jul-16 4:32 
GeneralRe: No overload for method 'PassStructIn' takes 4 arguments Pin
Member 1224497214-Jul-16 20:30
Member 1224497214-Jul-16 20:30 
GeneralRe: No overload for method 'PassStructIn' takes 4 arguments Pin
OriginalGriff14-Jul-16 20:38
mveOriginalGriff14-Jul-16 20:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.