PeekMessage (user32)
Last changed: -93.84.11.72

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern bool PeekMessage(out MSG lpMsg, HandleRef hWnd, uint wMsgFilterMin,
   uint wMsgFilterMax, uint wRemoveMsg);

User-Defined Types:

None.

Notes:

Specifing HandleRef instead of IntPtr as the hWnd type prevents the handle from going out of scope. All internal Microsoft PInvokes use HandleRef and not IntPtr.

Tips & Tricks:

Please add some!

Sample Code:

MSG message = new MSG();
PeekMessage(
    out message,
    new HandleRef(myWindow.Handle, myWindow),
    0,
    0,
    PM_REMOVE);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation
PeekMessage on MSDN