The WndProc function was missing the CALLBACK modifier.