GetMessage and PeekMessage execute the same code. The major difference between the two is in the case where there are no messages to be returned to the application. In this case, GetMessage puts the application to sleep while PeekMessage returns to the application with a NULL value.