本文整理汇总了C++中SAFERELEASE函数的典型用法代码示例。如果您正苦于以下问题:C++ SAFERELEASE函数的具体用法?C++ SAFERELEASE怎么用?C++ SAFERELEASE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SAFERELEASE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SAFERELEASE
HRESULT PreviewGenerator::ShowPreviewWithPreviewHandler(IStream *stream, CLSID cls)
{
DWORD dwRet = ERROR_BAD_ARGUMENTS;
if (iPHandler)
{
iPHandler->Unload();
SAFERELEASE(iPHandler);
}
IInitializeWithStream *iIStream;
HRESULT hr = CoCreateInstance(cls, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_IPreviewHandler, (LPVOID*)&iPHandler);
if (hr == S_OK)
{
hr = iPHandler->QueryInterface(IID_IInitializeWithStream, (LPVOID*)&iIStream);
}
else
{
return hr;
}
if ( iIStream)
{
hr = iIStream->Initialize(stream, STGM_READ);
}
if (iPHandler && hr == S_OK)
hr = DoPreview();
SAFERELEASE(iIStream);
return hr;
}
示例2: KillTimer
STDMETHODIMP CPolyTool::OnToolChanging(VARIANT varHint)
{
HRESULT hr = S_OK;
long lCount;
HWND hWnd;
if (nTimerID)
{
m_pUIView->get_HWND(&hWnd);
KillTimer(hWnd, nTimerID);
nTimerID = 0;
}
if(NULL != m_pBoundary)
{
hr = m_pCurrentBoundaryList->get_Count(&lCount);
if( FAILED(hr) ) goto EXIT_FAIL;
m_pCurrentBoundaryList->RemoveAt( lCount-1 );
SAFERELEASE(m_pCurrentThing);
SAFERELEASE(m_pBoundary);
SAFERELEASE(m_pCurrentThingFrame);
SAFERELEASE(m_pCurrentBoundaryList);
m_cVertices = 0;
}
EXIT_FAIL:
return S_OK;
}
示例3: SDLOG
void Console::cleanup() {
SDLOG(2, "Console cleanup\n")
device = NULL;
SAFERELEASE(vertexDeclaration);
SAFERELEASE(effect);
SAFERELEASE(fontTex);
}
示例4: Invalidate
HRESULT CGraphics::UninitializeDisplay(void)
{
Invalidate();
SAFERELEASE(m_Device);
SAFERELEASE(m_Direct3D);
if(IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE))
{
_aligned_free(m_Levels);
_aligned_free(m_LevelsBuffer);
_aligned_free(m_Waveform);
_aligned_free(m_WaveformBuffer);
}
else
{
free(m_Levels);
free(m_LevelsBuffer);
free(m_Waveform);
free(m_WaveformBuffer);
}
m_Levels = NULL;
m_LevelsBuffer = NULL;
m_Waveform = NULL;
m_WaveformBuffer = NULL;
m_Hwnd = NULL;
return S_OK;
}
示例5: ENTER_SECTION
HRESULT CAudio::UninitializeCapture(void)
{
ENTER_SECTION(this);
StopCapture();
// Check if uninitialized
if(!m_Capture)
return S_FALSE;
// Tell the thread to close
PostThreadMessage(m_CaptureId,WM_QUIT,NULL,NULL);
if(WaitForSingleObject(m_Capture,2000) == WAIT_TIMEOUT)
TerminateThread(m_Capture,0x000000FF);
CloseHandle(m_Capture);
m_Capture = NULL;
m_CaptureId = NULL;
SAFERELEASE(m_CaptureBuffer);
SAFERELEASE(m_SoundCapture);
return S_OK;
}
示例6: SAFERELEASE
void DS2Plugin::prePresent() {
SAFERELEASE(zBufferSurf);
SAFERELEASE(normalSurf);
SAFERELEASE(hdrRT);
aaStepStarted = false;
aoDone = false;
}
示例7: AddThingToTree
//
// fill the room node of the tree
//
void CThingTreeCtrl::FillRoomNode()
{
HRESULT hr = S_OK;
IThing *pUser = NULL;
IThing *pRoom = NULL;
if (!m_pWorld)
return;
if (FAILED(hr = m_pWorld->get_User(&pUser)))
goto exit;
if (!pUser || FAILED(hr = pUser->get_Container(&pRoom)))
goto exit;
if (!pRoom)
goto exit;
m_hRoom = AddThingToTree(TVI_ROOT, pRoom);
if (m_hRoom)
AddContentsToTree(m_hRoom, pRoom);
m_treeCtrl.Expand(m_hRoom, TVE_EXPAND);
m_treeCtrl.SortChildren(m_hRoom);
exit:
SAFERELEASE(pUser);
SAFERELEASE(pRoom);
}
示例8: dumpSurface
HRESULT RSManager::redirectSetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) {
if(dumpingFrame) {
IDirect3DSurface9* rt;
d3ddev->GetRenderTarget(RenderTargetIndex, &rt);
if(rt) {
dumpSurface(format("framedump_preswitch%03u_target%d_pointer%p", renderTargetSwitches, RenderTargetIndex, rt).c_str(), rt);
}
SAFERELEASE(rt);
}
HRESULT hr = plugin->redirectSetRenderTarget(RenderTargetIndex, pRenderTarget);
renderTargetSwitches++;
if(dumpingFrame) {
IDirect3DSurface9* rt;
d3ddev->GetRenderTarget(RenderTargetIndex, &rt);
if(rt) {
dumpSurface(format("framedump_postswitch%03u_target%d_pointer%p", renderTargetSwitches, RenderTargetIndex, rt).c_str(), rt);
}
SAFERELEASE(rt);
}
return hr;
}
示例9: SAFERELEASE
HRESULT C2DThingCoordTransformer::StoreThingCoords(IThing * pThing)
{
HRESULT hr = S_OK;
IThing* pTmpParentThing = NULL;
m_bDoTransform = TRUE;
if(NULL == pThing)
{
m_bDoTransform = FALSE;
hr = E_INVALIDARG;
goto EXIT_FAIL;
}
SAFERELEASE(m_pThing);
m_pThing = pThing;
SAFEADDREF(m_pThing);
IdentityMatrix(&m_d3dMatrix);
IdentityMatrix(&m_d3dInverseMatrix);
hr = m_pThing->get_Container(&pTmpParentThing);
if ( SUCCEEDED(hr) && pTmpParentThing)
{
BuildTransformation(pThing, pTmpParentThing);
}
goto EXIT_SUCCESS2;
EXIT_FAIL:
ASSERT(0);
EXIT_SUCCESS2:
SAFERELEASE(pTmpParentThing);
return hr;
}
示例10: ASSERT
STDMETHODIMP CAvatarProfileObject::UnMarshall(IUnMarshallBuffer* pbuffer)
{
HRESULT hr = S_OK;
ASSERT(pbuffer);
//clear current data.
SAFERELEASE(m_pBannedObjects);
SAFERELEASE(m_pKeys);
SAFERELEASE(m_pAvatar);
hr = CAvatarProfileObjectBase::UnMarshall(pbuffer);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
hr = m_pWorld->UnMarshallObjectProperty(pbuffer, (IObjectProperty**)&m_pBannedObjects);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
hr = m_pWorld->UnMarshallObjectProperty(pbuffer, (IObjectProperty**)&m_pKeys);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
hr = m_pWorld->UnMarshallObjectProperty(pbuffer, (IObjectProperty**)&m_pAvatar);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
ERROR_ENCOUNTERED:
return hr;
}
示例11: SAFERELEASE
STDMETHODIMP CAvatarProfileObject::ReadFromDisk(BSTR bstrFilename)
{
//clear current data.
SAFERELEASE(m_pBannedObjects);
SAFERELEASE(m_pKeys);
//load into buffer.
IUnMarshallBuffer *pbuffer = NULL;
HRESULT hr = CoCreateInstance(CLSID_UnMarshallBuffer, NULL, CLSCTX_INPROC_SERVER,
IID_IUnMarshallBuffer, (LPVOID*)&pbuffer);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
hr = pbuffer->ReadFromDisk(bstrFilename);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
//load into current object.
hr = UnMarshall(pbuffer);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
ERROR_ENCOUNTERED:
if (FAILED(hr))
Reset();
SAFERELEASE(pbuffer);
return hr;
}
示例12: SAFERELEASE
Shader::~Shader(void){
SAFERELEASE(vsBuffer);
SAFERELEASE(psBuffer);
SAFERELEASE(matrixBuffer);
SAFERELEASE(lightBuffer);
LOG("Shader: destructor");
}
示例13: SAFERELEASE
//--------------------------------------------------------------------------------------
DepthTexture::~DepthTexture() {
if(!m_isRESZ) {
if(m_pTexture != NULL) NvAPI_D3D9_UnregisterResource(m_pTexture);
if(m_pSurface != NULL) NvAPI_D3D9_UnregisterResource(m_pSurface);
}
SAFERELEASE(m_pSurface);
SAFERELEASE(m_pTexture);
}
示例14: InvokeToolEvent
BOOL CPolyTool::OnKeyDown( UINT nVirtKey, LPARAM lKeyData )
{
HRESULT hr = S_OK;
VARIANT_BOOL vbBool = VARIANT_TRUE;
long lCount;
if (nVirtKey == VK_BACK)
{
if(NULL != m_pBoundary)
{
if (m_cVertices > 2 )
{
hr = m_pBoundary->DeleteVertex(m_cVertices - 1);
if( FAILED(hr) ) goto EXIT_FAIL;
// if(vbBool != VARIANT_TRUE)
// MessageBeep(MB_ICONASTERISK);
// else
// {
m_cVertices--;
InvokeToolEvent(TOOLEVENT_BOUNDARYUPDATE, m_pBoundary, bstrNULL, bstrNULL, bstrNULL, VARIANT_FALSE);
// }
}
else
{
hr = m_pCurrentBoundaryList->get_Count(&lCount);
if( FAILED(hr) ) goto EXIT_FAIL;
hr = m_pCurrentBoundaryList->RemoveAt( lCount-1 );
if( FAILED(hr) ) goto EXIT_FAIL;
m_cVertices = 0;
// ClipCursor(NULL);
// ReleaseCapture();
SAFERELEASE(m_pCurrentThing);
SAFERELEASE(m_pBoundary);
SAFERELEASE(m_pCurrentThingFrame);
SAFERELEASE(m_pCurrentBoundaryList);
}
return TRUE;
}
}
else if (nVirtKey == VK_RETURN && m_cVertices > 2)
{
ClosePolygon(0, CPoint(0,0));
return TRUE;
}
//MessageBeep(-1);
EXIT_FAIL:
return FALSE;
}
示例15: SAFERELEASE
HRESULT CGraphics::Invalidate(void)
{
SAFERELEASE(m_SpriteBuffer);
SAFERELEASE(m_LineBuffer);
SAFERELEASE(m_BlurTexture);
SAFERELEASE(m_VisualizationTexture);
return S_OK;
}