In Windows 10 , something is wrong, ucrtbased.dll spits exceptions:
An unhandled exception at 0x542FF4E9 (ucrtbased.dll) in some.exe: 0xC000041D: An unhandled exception was detected during a user callback.
#if !_WIN64 #define swinp SetWindowLong #define gwinp GetWindowLong #define WINC_PTR GWL_USERDATA #else #define swinp SetWindowLongPtr #define gwinp GetWindowLongPtr #define WINC_PTR GWLP_USERDATA #endif // _WIN64 The code in which the exception occurs:
LRESULT window_base::p_msg_proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { window_base* self_; if (uMsg == WM_NCCREATE) { swinp(hWnd, WINC_PTR, LONG(LPCREATESTRUCT(lParam)->lpCreateParams)); return TRUE; } self_ = reinterpret_cast<window_base*>(gwinp(hWnd, WINC_PTR)); if (!self_) return DefWindowProc(hWnd, uMsg, wParam, lParam); // Именно тут return self_->msg_proc(hWnd, uMsg, wParam, lParam); } The msg_proc is a purely virtual f-tion protected:
virtual LRESULT WINAPI msg_proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) = 0; The message number at which the exception is thrown: WM_CANCELMODE