D3D-GetSurfaceLevel未处理的异常
D3D - GetSurfaceLevel unhandled exception
我正在创建D3D光标,所以首先我制作了Surface&纹理在执行此操作时,我在GetSurfaceLevel()函数上遇到了错误。
0x5B494B11处出现未处理的异常0xC0000005:读取位置0x00000000时发生访问冲突。
代码:
D3DXCreateTextureFromFile( g_D3dDevice, L"cursor1.bmp", &g_cursortex );
g_cursortex->GetSurfaceLevel( 0, &g_surfcursor );
g_D3dDevice->SetCursorProperties( 0, 0, g_surfcursor );
g_D3dDevice->ShowCursor( TRUE );
我该怎么办?
Unhandled exception at 0x5B494B11 0xC0000005: Access violation reading location 0x00000000.
这种错误是由取消引用NULL指针引起的,请检查是否已成功创建纹理。在调用g_cursortex->GetSurfaceLevel( 0, &g_surfcursor );
之前,请确保g_cursortex不为NULL
HRESULT hr = D3DXCreateTextureFromFile( g_D3dDevice, L"cursor1.bmp", &g_cursortex );
if (SUCCEEDED(hr))
{
g_cursortex->GetSurfaceLevel( 0, &g_surfcursor );
g_D3dDevice->SetCursorProperties( 0, 0, g_surfcursor );
}
相关文章:
- 如何修复链表类实现的未处理异常0xDDDDDDDD
- 在信号处理程序中捕获C++未处理的异常并恢复应用程序
- 在C++程序中使用的迭代器中未处理的异常
- 在 ******.exe 中0x00000000772CA267 (ntdll.dll) 处未处理的异常:0xC0000
- 未处理的异常与 cudaMemcpy2D
- 处理未处理的异常更改C++
- for 循环中未处理的异常
- VisualC++ 2010 有没有办法找出有关未处理异常错误的更多详细信息
- 为什么此代码导致未处理的异常失败
- 在OpenCV_core310.dll中使用findContours函数时,OpenCV引发未处理的异常
- 0x0F50DF58:0xC0000005:访问冲突读取位置0x0047CA04时未处理的异常
- 使用 getline 时未处理的异常
- 错误 : 异常 : 引发未处理的异常: 读取访问冲突.0xDDDDDDDD临时温度
- 核心消息传递中未处理的异常.dll在程序关闭期间
- 在 Hello World.exe 中0x0F828F0E (ucrtbased.dll) 处未处理的异常: 0xC00
- 从向量中删除元素时未处理的异常
- C++ 程序中双链表的未处理异常
- 在 Myfile.exe 中0x00831D39时未处理的异常:0xC00000FD:堆栈溢出(参数:0x0000000
- CUDA 编程未处理的异常和堆栈溢出
- 在多线程c++ 11程序中,当异常未处理时会发生什么