What does Windows error code 1407 (ERROR_CANNOT_FIND_WND_CLASS) mean?

 
Previous Next
ERROR_TLW_WITH_WSCHILD ERROR_WINDOW_OF_OTHER_THREAD

ERROR_CANNOT_FIND_WND_CLASS

USER32 cannot resolve the requested window class

Every created window belongs to a window class. The class can be a predefined system class or an application class registered with RegisterClass or RegisterClassEx. Class lookup also involves the registering module instance.

Typical causes are spelling/encoding mismatches in the class name, creating the window before registration, using the wrong HINSTANCE, or unloading a DLL whose registration/lifetime assumptions were incorrect. An atom returned by class registration must also be passed in the documented atom form.

What to check

  • Log the class name or atom and hInstance passed to CreateWindowEx.
  • Verify that registration succeeded in the same process before creation.
  • Check ANSI/Unicode build paths so the class name is identical at registration and creation.
  • For DLL-defined classes, make registration and explicit unregistration part of module lifecycle.

ERROR_CLASS_DOES_NOT_EXIST is a class-management status; this page focuses on class resolution while creating or locating a window class for USER32 use.

References


Looking for a different code? Search another status or error code.