Alfitsi

I created a message with: "Message msg = Message.Create((IntPtr)iAsyncResult.AsyncState, WM_CUSTOMMSG, (IntPtr)null, (IntPtr)null);"

How do I send it

Thanks



Re: Windows Forms General System.Windows.Forms.Message in C#

Peter Ritchie

The Message structure is used for the encapsulation of received messages. There's nothing to actually "send" it. You'd have to PInvoke [Send|Post]Message, possibly like:
void SendMessage(ref Message msg)
{
UnsafeNativeMethods.SendMessage(msg.HWnd, msg.Msg, msg.WParam, msg.LParam);
}




Re: Windows Forms General System.Windows.Forms.Message in C#


Re: Windows Forms General System.Windows.Forms.Message in C#

Richard Guion

I've often wondered why SendMessage and PostMessage are not supported within a .NET assembly. This PInvoke isn't too bad, but it would have been more convenient just to use a method in Message. Does anyone know the reason why the .NET Framework dudes didn't support SendMessage




Re: Windows Forms General System.Windows.Forms.Message in C#

littleguru

It's possibly to low level to be provided in the .NET Framework. The .NET Framework doesn't want people to use SendMessage to do their stuff.