What is the content of the MSG that's returned by PeekMessage? Give us all six fields, and let us know whether the value of the HWND makes sense in the context of the windows owned by the calling thread.

In addition, it seems that you're in an infinite loop, returning many MSGs, so give us a sampling of them if the content differs.

This is related to the initial question of why msg.wparam has a value of 0x0113, which doesn't make any sense at all.

Incidentally, is it possible that your program is posting user-defined messages that just by coincidence have the same value as WM_TIMER (ie, 0x0113)?

Mike