If the program starts with the mouse already in the client area without moving, why do you get a beep?

Because of the spurious WM_MOUSEMOVE message that is generated when a window is created. In this case, the spurious message is a good thing, since it lets us do our mouse work at window creation.