I have some problems with heap corruption. The warning can be observed while using CreateWindowExW function. I know that it is usually a memory error, but how could I search
Change
WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
to
WNDCLASSEX wcex = { 0 };
You're initializing pointer members of WNDCLASSEX to non-null (but nonsensical values, namely sizeof(WNDCLASSEX)).