【发布时间】:2013-03-12 18:21:07
【问题描述】:
我有 MainScreen.cpp
void MainScreen::Show(D2DResources* pD2DResources)
{
HRESULT hr = S_OK;
ID2D1Bitmap* pBitmap=pD2DResources->GetpCurrentScreen();
hr = pD2DResources->LoadBitmapFromFile(
pD2DResources->GetpRT(),
pD2DResources->GetpIWICIF(),
L".\\Images\\MainScreen.jpg",
0,
0,
&pBitmap
);
if(SUCCEEDED(hr))pD2DResources->DrawScreen();
}
有时会像这样调用 MainScreen::Show() 函数
MainScreen->Show(&d2DResources);
但是,似乎当 pD2DResources 在 MainScreen::Show() 函数中调用 DrawScreen() 时,存储在 &pBitmap 中的任何内容都没有保存。实际上,我得到了一个未处理的异常,当它发生时,应该收到 pBitmap 的值的 pCurrentScreen 是 0x00000000。
我该怎么办?
【问题讨论】:
-
还是那一小段代码有问题?
-
我做了一些改动,现在可以了。
标签: c++ class function pointers direct2d