In delphi, I can create my own message like this,
const MY_MESSAGE = WM_USER+100;
procedure MyMessage(var Msg: TMessage); message MY_MESSAGE;
procedure TForm1.MyMessage(var Msg: TMessage);
begin
....
end;
bu in c# I can do that like this
public static uint ms;
protected override void WndProc(ref Message m)
{
if(m.Msg == ms)
MessageBox.Show("example");
else
base.WndProc(ref m);
}
void Button1Click(object sender, EventArgs e)
{
PostMessage(HWND_BROADCAST,ms,IntPtr.Zero,IntPtr.Zero);
}
but I don't want to override WndProc(), I want to create my own MyMessage() function, and when I post message it will run.
How can I do that? Thanks.
That's a special feature of Delphi of which there is no analogue in C#. In C# you need to override WndProc()
.