您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AfxThrowMemoryException函数代码示例

51自学网 2021-06-01 19:46:15
  C++
这篇教程C++ AfxThrowMemoryException函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中AfxThrowMemoryException函数的典型用法代码示例。如果您正苦于以下问题:C++ AfxThrowMemoryException函数的具体用法?C++ AfxThrowMemoryException怎么用?C++ AfxThrowMemoryException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了AfxThrowMemoryException函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ASSERT_VALID

void CListViewWalkerPropertySheet::InsertPage(int iIndex, CPropertyPage* pPage){    ASSERT_VALID( this );    ASSERT( pPage != NULL );    ASSERT_KINDOF( CPropertyPage, pPage );    ASSERT_VALID( pPage );    m_pages.InsertAt(iIndex, pPage);    BuildPropPageArray();    if (m_hWnd != NULL)    {        PROPSHEETPAGE* ppsp = const_cast<PROPSHEETPAGE*>(m_psh.ppsp);        for (UINT i = 0; i < m_psh.nPages; i++) {            if (i == (UINT)iIndex)                break;            (BYTE*&)ppsp += ppsp->dwSize;        }        HPROPSHEETPAGE hPSP = CreatePropertySheetPage(ppsp);        if (hPSP == NULL)            AfxThrowMemoryException();        if (!SendMessage(PSM_INSERTPAGE, iIndex, (LPARAM)hPSP)) {            DestroyPropertySheetPage(hPSP);            AfxThrowMemoryException();        }    }}
开发者ID:acat,项目名称:emule,代码行数:29,


示例2: ASSERT_VALID

void CBasePropertySheet::AddPage(CPropertyPage* pPage){	ASSERT_VALID(this);	ASSERT(pPage != NULL);	ASSERT_KINDOF(CPropertyPage, pPage);	ASSERT_VALID(pPage);	// add page to internal list	m_pages.Add(pPage);	// add page externally	if (m_hWnd != NULL)	{		// build new prop page array		AFX_OLDPROPSHEETPAGE *ppsp = new AFX_OLDPROPSHEETPAGE[m_pages.GetSize()];		memcpy(ppsp, m_psh.ppsp, sizeof(AFX_OLDPROPSHEETPAGE) * (m_pages.GetSize()-1));		delete[] (PROPSHEETPAGE*)m_psh.ppsp;		m_psh.ppsp = (PROPSHEETPAGE*)ppsp;		ppsp += m_pages.GetSize()-1;		// copy processed PROPSHEETPAGE struct to end		memcpy(ppsp, &pPage->m_psp, sizeof(pPage->m_psp));//		pPage->PreProcessPageTemplate((PROPSHEETPAGE&)*ppsp, IsWizard());		CPropertyPage_PreProcessPageTemplate((_CCPropertyPage*)pPage, (PROPSHEETPAGE&)*ppsp, IsWizard());		HPROPSHEETPAGE hPSP = CreatePropertySheetPage((PROPSHEETPAGE*)ppsp);		if (hPSP == NULL)			AfxThrowMemoryException();		if (!SendMessage(PSM_ADDPAGE, 0, (LPARAM)hPSP))		{			DestroyPropertySheetPage(hPSP);			AfxThrowMemoryException();		}	}}
开发者ID:hackshields,项目名称:antivirus,代码行数:35,


示例3: ASSERT_VALID

void CMemFile::GrowFile(DWORD dwNewLen){	ASSERT_VALID(this);	if (dwNewLen > m_nBufferSize)	{		// grow the buffer		DWORD dwNewBufferSize = (DWORD)m_nBufferSize;		// watch out for buffers which cannot be grown!		ASSERT(m_nGrowBytes != 0);		if (m_nGrowBytes == 0)			AfxThrowMemoryException();		// determine new buffer size		while (dwNewBufferSize < dwNewLen)			dwNewBufferSize += m_nGrowBytes;		// allocate new buffer		BYTE* lpNew;		if (m_lpBuffer == NULL)			lpNew = Alloc(dwNewBufferSize);		else			lpNew = Realloc(m_lpBuffer, dwNewBufferSize);		if (lpNew == NULL)			AfxThrowMemoryException();		m_lpBuffer = lpNew;		m_nBufferSize = dwNewBufferSize;	}	ASSERT_VALID(this);}
开发者ID:anyue100,项目名称:winscp,代码行数:33,


示例4: pLock

void CDownloadWithSources::Serialize(CArchive& ar, int nVersion)	// DOWNLOAD_SER_VERSION{	CDownloadBase::Serialize( ar, nVersion );	CQuickLock pLock( Transfers.m_pSection );	if ( ar.IsStoring() )	{		DWORD_PTR nSources = GetCount();		if ( nSources > Settings.Downloads.SourcesWanted )			nSources = Settings.Downloads.SourcesWanted;		ar.WriteCount( nSources );		for ( POSITION posSource = GetIterator() ; posSource && nSources ; nSources-- )		{			CDownloadSource* pSource = GetNext( posSource );			pSource->Serialize( ar, nVersion );		}		ar.WriteCount( m_pXML != NULL ? 1 : 0 );		if ( m_pXML ) m_pXML->Serialize( ar );	}	else // Loading	{		for ( DWORD_PTR nSources = ar.ReadCount() ; nSources ; nSources-- )		{			// Create new source			//CDownloadSource* pSource = new CDownloadSource( (CDownload*)this );			CAutoPtr< CDownloadSource > pSource( new CDownloadSource( static_cast< CDownload* >( this ) ) );			if ( ! pSource )				AfxThrowMemoryException();			// Load details from disk			pSource->Serialize( ar, nVersion );			// Extract ed2k client ID from url (m_pAddress) because it wasn't saved			if ( ! pSource->m_nPort && _tcsnicmp( pSource->m_sURL, _T("ed2kftp://"), 10 ) == 0 )			{				CString strURL = pSource->m_sURL.Mid(10);				if ( ! strURL.IsEmpty() )					_stscanf( strURL, _T("%lu"), &pSource->m_pAddress.S_un.S_addr );			}			InternalAdd( pSource.Detach() );		}		if ( ar.ReadCount() )		{			m_pXML = new CXMLElement();			if ( ! m_pXML )				AfxThrowMemoryException();			m_pXML->Serialize( ar );		}	}}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:57,


示例5: ASSERT_VALID

void CEditView::ReadFromArchive(CArchive& ar, UINT nLen)	// Read certain amount of text from the file, assume at least nLen	// characters (not bytes) are in the file.{	ASSERT_VALID(this);	LPVOID hText = LocalAlloc(LMEM_MOVEABLE, (nLen+1)*sizeof(TCHAR));	if (hText == NULL)		AfxThrowMemoryException();	LPTSTR lpszText = (LPTSTR)LocalLock(hText);	ASSERT(lpszText != NULL);	if (ar.Read(lpszText, nLen*sizeof(TCHAR)) != nLen*sizeof(TCHAR))	{		LocalUnlock(hText);		LocalFree(hText);		AfxThrowArchiveException(CArchiveException::endOfFile);	}	// Replace the editing edit buffer with the newly loaded data	lpszText[nLen] = '/0';#ifndef _UNICODE	if (afxData.bWin32s)	{		// set the text with SetWindowText, then free		BOOL bResult = ::SetWindowText(m_hWnd, lpszText);		LocalUnlock(hText);		LocalFree(hText);		// make sure that SetWindowText was successful		if (!bResult || ::GetWindowTextLength(m_hWnd) < (int)nLen)			AfxThrowMemoryException();		// remove old shadow buffer		delete[] m_pShadowBuffer;		m_pShadowBuffer = NULL;		m_nShadowSize = 0;		ASSERT_VALID(this);		return;	}#endif	LocalUnlock(hText);	HLOCAL hOldText = GetEditCtrl().GetHandle();	ASSERT(hOldText != NULL);	LocalFree(hOldText);	GetEditCtrl().SetHandle((HLOCAL)(UINT)(DWORD)hText);	Invalidate();	ASSERT_VALID(this);}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:49,


示例6: ThrowARSException

//////////////////////////////////////////////////////////////////////////////// Fills up p_arsEntryId with the contents of EntryId// IN: EntryId// OUT: p_arsEntryId// Returns: 0 - on error, 1 - on successint CFieldValuePair::FillEntryId(CEntryId &EntryId, AREntryIdList *p_arsEntryId){	// if EntryId is empty, throw an error	if(EntryId.GetCount() == 0)	{		ThrowARSException(CREC_ENTRY_ID_EMPTY, "CFieldValuePair::FillEntryId()");		return 0;	}	p_arsEntryId->numItems = EntryId.GetCount(); // store how many id's will make up this entry id list	p_arsEntryId->entryIdList = (AREntryIdType*)malloc(sizeof(AREntryIdType) * EntryId.GetCount()); // allocated memory for entryId	if(p_arsEntryId->entryIdList == NULL)	// ensure memory was allocated	{		p_arsEntryId->numItems = 0;		AfxThrowMemoryException();		return 0; // return empty entry id because of error	}	// now fill p_arsEntryId with the entry id's in the current CEntryId object	AREntryIdType *pEntryId = p_arsEntryId->entryIdList;	POSITION pos = EntryId.GetHeadPosition();	for(unsigned int i=0;		i<p_arsEntryId->numItems; 		i++, pEntryId++)	{		// should make sure EntryId doesn't have any strings longer than pEntryId		// can handle		strcpy((char*)pEntryId, LPCSTR(EntryId.GetNext(pos)) );	}		// Don't call FreeAREntryIdList.  This should be called by the calling function	return 1;}
开发者ID:mellertson,项目名称:ARExplorer,代码行数:39,


示例7: GetConfig

void CLATEDView::OnAddlink() {    CLCConfig* pConfig = NULL;    CLCLink* pLink = NULL;    pConfig = GetConfig();    if(!pConfig) {        return;    }    {   //do this in a block due to hourglass        CHourglass glass;        pConfig->ActualizeLinks();            pLink = new CLCLink();        if(!pLink) {            AfxThrowMemoryException();                }    }    CDialogTarget dialog(pConfig,pLink,NULL,false,IDS_INSERT_LINK, this,0);	switch(dialog.DoModal()) {	    case IDOK:            pConfig->AddLink(pLink);            SetModified();            break;        case IDCANCEL:        default:            pLink->Release();            break;    }}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:33,


示例8: BrowseDir

void CWizBrowseDirectory::BrowseDir(CString& retStr, CWnd* pFromWnd, LPCTSTRTitle) {    LPMALLOC pMalloc;    /* Get's the Shell's default allocator */    if (NOERROR != ::SHGetMalloc(&pMalloc)) AfxThrowMemoryException();        BROWSEINFO   bi;    TCHAR        pszBuffer[MAX_PATH];    LPITEMIDLIST pidl;    InitBrowseInfo(bi, pFromWnd, Title);    bi.pszDisplayName = pszBuffer;    // This next call issues the dialog box   __try {                if ((pidl = ::SHBrowseForFolder(&bi)) != NULL) {          __try {                if (::SHGetPathFromIDList(pidl, pszBuffer)) {                     //At this point pszBuffer contains the selected path */                    retStr = pszBuffer;                                }                        }          __finally {                                // Free the PIDL allocated by SHBrowseForFolder                pMalloc->Free(pidl);            }        }    }
开发者ID:KerwinMa,项目名称:AerothFlyffSource,代码行数:28,


示例9: ASSERT

void CSelNumberDlgUsage::Change (const CString &strTableName, UINT uiCaption, CString& strAktNummer, CSelectSet* pSelectSet){	try	{			if (!m_pNumberDlg)		{			ASSERT (NULL != pSelectSet);			ASSERT (pSelectSet -> IsOpen ());			ASSERT (!strTableName.IsEmpty ());			m_pNumberDlg = new CSelNumberDlg (this, pSelectSet, uiCaption,											  strTableName);			if (!m_pNumberDlg -> Create (IDD_SEL_NUMMER))				AfxThrowMemoryException ();		}			//	aktuelle Selektion setzen		m_pNumberDlg -> StoreSelection (strAktNummer);	//	Fenster aktivieren		m_pNumberDlg -> ShowWindow (SW_SHOWNORMAL);			m_pNumberDlg -> SetFocus ();	}	catch (CDaoException *e)	{		:: DisplayDaoException (e);		e -> Delete ();		DELETE_OBJ (m_pNumberDlg);	}	catch (CException* e)	{		e -> ReportError ();		e -> Delete ();		DELETE_OBJ (m_pNumberDlg);	}}
开发者ID:hkaiser,项目名称:TRiAS,代码行数:35,


示例10: ASSERT

CSafeThread* CSafeThread::BeginThread(CRuntimeClass* pThreadClass,		int nPriority, UINT nStackSize, DWORD dwCreateFlags,		LPSECURITY_ATTRIBUTES lpSecurityAttrs){	ASSERT(pThreadClass != NULL);	ASSERT(pThreadClass->IsDerivedFrom(RUNTIME_CLASS(CSafeThread)));	CSafeThread* pThread = (CSafeThread*)pThreadClass->CreateObject();	if (pThread == NULL)		AfxThrowMemoryException();	ASSERT_VALID(pThread);	pThread->m_pThreadParams = NULL;	if (!pThread->CreateThread(dwCreateFlags|CREATE_SUSPENDED, nStackSize,		lpSecurityAttrs))	{		pThread->Delete();		return NULL;	}	VERIFY(pThread->SetThreadPriority(nPriority));	if (!(dwCreateFlags & CREATE_SUSPENDED))	{		ENSURE(pThread->ResumeThread() != (DWORD)-1);	}	return pThread;}
开发者ID:HackLinux,项目名称:eMule-IS-Mod,代码行数:27,


示例11: GetClientRect

BOOL CPropertyChoiceDlg::OnInitDialog() {	CPropertyPage::OnInitDialog();	// nichtmodalen CPropertySheet erzeugen	TRY {	CRect rcClient;		GetClientRect(&rcClient);		m_pSheet = new CChoiceParent (rcClient, m_strDesc.c_str()); 		if (!m_pSheet -> Create(this, WS_VISIBLE|WS_CHILD|DS_CONTROL, 0))			AfxThrowMemoryException();	// geforderte Pages einh
C++ AfxThrowResourceException函数代码示例
C++ AfxThrowFileException函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。