PRB: PeekMessage(hWnd==-1) Causes Fatal Exit 0x0007

ID Number: Q74701

3.00

WINDOWS

docerr

Summary:

SYMPTOMS

When the PeekMessage function is called with an hWnd parameter of

-1, no messages are returned by the retail version of Windows, and the

debugging version of Windows exits with fatal exit 0x0007 (Invalid

Window Handle). According to page 4-330 of the "Microsoft Windows

Software Development Kit Reference Volume 1," this call should

return only messages with an hWnd of NULL that are posted by the

PostAppMessage function.

CAUSE

Microsoft has confirmed that the documentation is incorrect. The

PeekMessage function should not be called with a hWnd parameter of

-1.

RESOLUTION

Calling PeekMessage with a hWnd parameter of NULL will retrieve

messages that were posted with the PostAppMessage function.

Microsoft has confirmed that this documentation error has been

corrected on page 739 of the "Microsoft Windows Software

Development Kit Programmer's Reference Volume 2: Functions" for

version 3.10.

Additional reference words: docerr 3.00