Jan,
Absolutely, one way I have achieved this in the past is using the
System.Diagnostics.Process class, there are methods to retrieve the
current process (Example: use the Process.MainWindowHandle property
instead of PInvoking/retrieving the HWND from FindWindow()). Based on a
valid handle you
Hi Keith,
many thanks for your help! I will try your test code and also hope this
helps! ;)
But a question I still have: Works the CopyData message between two
processes? I ask because my forms running in different applications.
Thanks again and Regards,
Jan
You can read messages from the DOTNET
Hi Jan,
The code you have below does work the way it was intended, I am including
my test code.
/ NativeMethods.cs ***/
public class NativeMethods
{
public NativeMethods(){}
[StructLayout(LayoutKind.Sequential)]
public struct CopyDataStruct
{
public string ID;
public int Length;
publi
Hi Keith,
sure I can post the code. ;) Here it is:
/** In my sending form **/
public const int WM_COPYDATA = 0x004A;
// this is the data to be send
[StructLayout(LayoutKind.Sequential)]
public struct CopyDataStruct {
public string ID;
public int Length;
public string Data;
}
CopyDataStruc
Hi Jan,
Could you post the code you are trying to get working with WM_COPYDATA?
Thanks,
Keith
On Mon, 29 Apr 2002 01:15:53 -0700, Jan Dropczynski wrote:
>Hi Steve,
>thanks for your help.
>
>And I have another question. I have found the WM_COPYDATA message. How
>about with it? Do you know how
Hi Steve,
thanks for your help.
And I have another question. I have found the WM_COPYDATA message. How
about with it? Do you know how it works?
I have a problem with WM_COPYDATA because if use it nothing happens. The
receiving application don't get that message.
Do you know something about WM_COP
- Original Message -
From: "Axel Heitland" <[EMAIL PROTECTED]>
Sent: Friday, April 26, 2002 05:23
Subject: Re: Send data with SendMessage
>I don't know if I remember correctly, but maybe a HGLOBAL allocated with
>GlobalAlloc(GHND) could give you a appropriate piece of memory; but
>that'
Hi Axel,
thanks for your help. I will try it with your sample. ;)
And if I still have questions again I'm here again.
Regards,
Jan
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
If you're crossing a process boundary with your message a simple pointer
is not sufficient.
For the OS a message is a simple struct with a WPARAM and a LPARAM
inside.
Inprocess you can easily cast pointers to these, but that crashes when
the receiving window lives in a different process.
I don't