I am creating a Simple Direct2D Application . Unfortunately, this gives an unhandled exception. The function in which it occurs:
void DemoApp::OnResize(UINT width, UINT height) { if (m_pRenderTarget) <----|****The exception occurs here.....**** { // Note: This method can fail, but it okay to ignore the // error here, because the error will be returned again // the next time EndDraw is called. m_pRenderTarget->Resize(D2D1::SizeU(width, height)); } }
And the code snippet calling OnResize ():
DemoApp *pDemoApp = reinterpret_cast<DemoApp *>(static_cast<LONG_PTR>( ::GetWindowLongPtrW( hwnd, GWLP_USERDATA ))); bool wasHandled = false; if (pDemoApp) { switch (message) { case WM_SIZE: { UINT width = LOWORD(lParam); UINT height = HIWORD(lParam); pDemoApp->OnResize(width, height); } result = 0; wasHandled = true; break; /*rest of switch case*/ }
Exception: Unhandled exception in 0x00007FF6BE402CCA in Simple Direct2D application.exe: 0xC000041D: An unhandled exception occurred during user callback. occurred
Screenshot:
As soon as I start debugging, the program throws an exception. I even copied the program word for word from the site. Since I'm new to the DirectX world, I don't know about the exception. What should I do?
. 32- , 64- .
Microsoft Direct2D.
this SetWindowLongPtr PtrToUlong . 64- this 8 , SetWindowLongPtr 8 , PtrToUlong unsigned long, 4 . , PtrToUlong 4 this, .
this
SetWindowLongPtr
PtrToUlong
unsigned long
, PtrToUlong( pDemoApp ) (LONG_PTR)pDemoApp
PtrToUlong( pDemoApp )
(LONG_PTR)pDemoApp
P.S. , , MS , Win32 , UWP. DirectX Direct2D ATL, . ATL : CComPtr , CWindowImpl .
: .
, , -, , , , . SetWindowLong, , GetWindowLong, null, () , , ( , ). , , SetWindowLong, DemoApp, - , . , , ,
, Unicode- GetWindowLongPtr, ( ). , Unicode-.
Source: https://habr.com/ru/post/1684247/More articles:Java date vs Gregorian calendar / 48 hours difference? - javaCollision avoidance with new paths - javascriptСрок службы функции в Rust - rustClass import in classes - pythonWhy does this regular expression work in JavaScript, but not C #? - c #Running a multiplayer machine in parallel - vagrantAndroid temperature zones? - androidHow does a literal class compile in Java bytecode? - javaNFC Temperature Logger Commands - androidUsing Bootstrap DatetimePicker with Sweet Alert 2 - Displaying a Warning Calendar - jqueryAll Articles