I did some testing with this, and it looks like you can use a message filter for this:
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
CreatedFormMessageFilter filter = new CreatedFormMessageFilter();
Application.AddMessageFilter(filter);
Application.Run(new Form1());
}
}
class CreatedFormMessageFilter : IMessageFilter
{
EventHandler _formCreated;
public event EventHandler FormCreated
{
add
{
_formCreated += value;
}
remove
{
_formCreated -= value;
}
}
public bool PreFilterMessage(ref Message m)
{
if (m.Msg == 799)
{
if (_formCreated != null)
{
_formCreated(this, EventArgs.Empty);
}
}
return false;
}
}
The above code is based on a message filter. A filter can be used for, as the name says, filtering specific messages, but this means that the messages pass through this method. I did some testing, and it looks like message ID
799
is the one you need.