static void Main() { using (MessageWindow window = new MessageWindow()) { const int WM_COMMAND = 0x111; window.MessageHandlers[WM_COMMAND] = (m) => { MessageBox.Show(m.Msg.ToString()); }; window.PostMessage(WM_COMMAND, IntPtr.Zero, IntPtr.Zero); Application.Run(new Form()); } }