Friday, 4 December 2009

Hooking into the windows message loop

Ive just been trying to figure out a way to hook into the windows message loop of a WinForm.

protected override void WndProc(ref Message m)
Trace.WriteLine(m.Msg.ToString() + “: “ + m.ToString());

base.WndProc(ref m);

In an attempt to fix a form that hangs when you lock the computer. Haven't fixed the form yet but the message loop helps.

Update: In the end it was controls being created on a background thread which lead to the hang.