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
As pointed out above, heap corruption is often detected after the real corruption has already occurred by some DLL/module loaded within your process. From your post it looks like this issue is windows platform specific so I would suggest you to use WinDBG/Pageheap and find out where actual memory corruption is happening. One very very good article about heap memory corruption analysis can be found from the book "Advanced Windows Debugging, Author: By: Mario Hewardt; Daniel Pravat" Chapter 06
http://advancedwindowsdebugging.com/ch06.pdf
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)).