本文整理汇总了C++中ATLTRY函数的典型用法代码示例。如果您正苦于以下问题:C++ ATLTRY函数的具体用法?C++ ATLTRY怎么用?C++ ATLTRY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ATLTRY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _ASSERTE
///////////////////////////////////////////////////////////////////////////////
// ein neues Objekt zum Baum hinzufügen
bool CSpatialTreeNode::AddTile(CPgrTile *pTile, int nMaxDepth)
{
// If there are subnodes, then consider wether this object
// will fit in them.
if (nMaxDepth > 1 && m_nSubNodes > 0) {
for (int i = 0; i < m_nSubNodes; ++i) {
_ASSERTE(NULL != m_apsSubNode[i]);
if (m_apsSubNode[i] -> CheckObjectContained(pTile))
return m_apsSubNode[i] -> AddTile(pTile, nMaxDepth - 1);
}
}
else if (nMaxDepth > 1 && 0 == m_nSubNodes) {
// Otherwise, consider creating four subnodes if could fit into
// them, and adding to the appropriate subnode.
double adfBoundsMinH1[SPATIALTREE_DIMENSION], adfBoundsMaxH1[SPATIALTREE_DIMENSION];
double adfBoundsMinH2[SPATIALTREE_DIMENSION], adfBoundsMaxH2[SPATIALTREE_DIMENSION];
double adfBoundsMin1[SPATIALTREE_DIMENSION], adfBoundsMax1[SPATIALTREE_DIMENSION];
double adfBoundsMin2[SPATIALTREE_DIMENSION], adfBoundsMax2[SPATIALTREE_DIMENSION];
double adfBoundsMin3[SPATIALTREE_DIMENSION], adfBoundsMax3[SPATIALTREE_DIMENSION];
double adfBoundsMin4[SPATIALTREE_DIMENSION], adfBoundsMax4[SPATIALTREE_DIMENSION];
SplitBounds(m_dBoundsMin, m_dBoundsMax, adfBoundsMinH1, adfBoundsMaxH1, adfBoundsMinH2, adfBoundsMaxH2);
SplitBounds(adfBoundsMinH1, adfBoundsMaxH1, adfBoundsMin1, adfBoundsMax1, adfBoundsMin2, adfBoundsMax2);
SplitBounds(adfBoundsMinH2, adfBoundsMaxH2, adfBoundsMin3, adfBoundsMax3, adfBoundsMin4, adfBoundsMax4);
if (CheckObjectContained(pTile, adfBoundsMin1, adfBoundsMax1) ||
CheckObjectContained(pTile, adfBoundsMin2, adfBoundsMax2) ||
CheckObjectContained(pTile, adfBoundsMin3, adfBoundsMax3) ||
CheckObjectContained(pTile, adfBoundsMin4, adfBoundsMax4))
{
m_nSubNodes = 4;
ATLTRY((
m_apsSubNode[0] = new CSpatialTreeNode(adfBoundsMin1, adfBoundsMax1),
m_apsSubNode[1] = new CSpatialTreeNode(adfBoundsMin2, adfBoundsMax2),
m_apsSubNode[2] = new CSpatialTreeNode(adfBoundsMin3, adfBoundsMax3),
m_apsSubNode[3] = new CSpatialTreeNode(adfBoundsMin4, adfBoundsMax4)
));
// recurse back on this node now that it has subnodes
return AddTile(pTile, nMaxDepth);
}
}
// If none of that worked, just add it to this nodes list.
++m_nFeatureCount;
CPgrTile * *pFeatureIds = SfRealloc(m_pFeatureIds, sizeof(CPgrTile *) * m_nFeatureCount);
if (NULL != pFeatureIds) {
m_pFeatureIds = pFeatureIds;
ATLTRY(m_pFeatureIds[m_nFeatureCount - 1] = new CPgrTile(*pTile));
return true;
}
return false;
}
示例2: ATLTRY
///////////////////////////////////////////////////////////////////////////////
// Objektgeometrie besorgen
bool CObjGeometrie::FInit (bool fStatisticsOnly)
{
// Statistik anfordern
if (!DEX_GetObjStatistik (*this))
return false;
if (fStatisticsOnly)
return true;
// Felder anfordern
ATLTRY(pdblX = new double [lCnt]);
ATLTRY(pdblY = new double [lCnt]);
if (pdblX == NULL || pdblY == NULL)
return false;
if (iKCnt > 0) {
if (iObjTyp == OGFlaeche) {
ATLTRY(plCnt = new long [iKCnt]);
if (plCnt == NULL)
return false;
}
else if (iObjTyp == OGText) {
((TEXTGEOMETRIE &)*this).pText = new char [iKCnt+1];
if (((TEXTGEOMETRIE &)*this).pText == NULL)
return false;
}
}
// Geometrie holen
iFlags |= OGConverted;
if (!DEX_GetObjGeometrie (*this))
return false;
// bei Linien/Flächen vergleichbare Position herstellen
bool fResult = true;
if (OGFlaeche == iObjTyp)
{
fResult = AdjustAreaGeometry();
fResult &= AdjustIslands(); // Inseln sortieren
}
else if (OGLinie == iObjTyp)
fResult = AdjustLineGeometry();
// Hashwerte berechnen
if (1.0 == m_dKoeff) {
m_lXHash = HashKoords(&X(0), lCnt*sizeof(double));
m_lYHash = HashKoords(&Y(0), lCnt*sizeof(double));
}
else {
m_lXHash = HashKoordsTolerance(&X(0), lCnt, m_dKoeff);
m_lYHash = HashKoordsTolerance(&Y(0), lCnt, m_dKoeff);
}
return fResult;
}
示例3: ATLASSERT
void CComSafeArray::Create(VARTYPE vtSrc, DWORD dwDims, SAFEARRAYBOUND *rgsabound)
{
ATLASSERT(dwDims > 0);
ATLASSERT(rgsabound != NULL);
// Validate the VARTYPE for SafeArrayCreate call
ATLASSERT( !(vtSrc & VT_ARRAY) );
ATLASSERT( !(vtSrc & VT_BYREF) );
ATLASSERT( !(vtSrc & VT_VECTOR) );
ATLASSERT(vtSrc != VT_EMPTY);
ATLASSERT(vtSrc != VT_NULL);
// Free up old safe array if necessary
Clear();
ATLTRY( parray = ::SafeArrayCreate(vtSrc, dwDims, rgsabound) );
if (parray == NULL) {
ATLTRACE2(atlTraceDBProvider, 0, "CComSafeArray::Create Error : OOM\n");
return;
}
vt = unsigned short (vtSrc | VT_ARRAY);
m_dwDims = dwDims;
m_dwElementSize = GetElemSize();
}
示例4: IDataObject_Constructor
/**************************************************************************
* IDataObject_Constructor
*/
HRESULT IDataObject_Constructor(HWND hwndOwner, LPCITEMIDLIST pMyPidl, LPCITEMIDLIST * apidl, UINT cidl, IDataObject **dataObject)
{
CComObject<IDataObjectImpl> *theDataObject;
CComPtr<IDataObject> result;
HRESULT hResult;
if (dataObject == NULL)
return E_POINTER;
*dataObject = NULL;
ATLTRY (theDataObject = new CComObject<IDataObjectImpl>);
if (theDataObject == NULL)
return E_OUTOFMEMORY;
hResult = theDataObject->QueryInterface (IID_IDataObject, (void **)&result);
if (FAILED (hResult))
{
delete theDataObject;
return hResult;
}
hResult = theDataObject->Initialize (hwndOwner, pMyPidl, apidl, cidl);
if (FAILED (hResult))
return hResult;
*dataObject = result.Detach ();
TRACE("(%p)->(apidl=%p cidl=%u)\n", *dataObject, apidl, cidl);
return S_OK;
}
示例5: IEnumFORMATETC_Constructor
HRESULT IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[], IEnumFORMATETC **enumerator)
{
CComObject<IEnumFORMATETCImpl> *theEnumerator;
CComPtr<IEnumFORMATETC> result;
HRESULT hResult;
if (enumerator == NULL)
return E_POINTER;
*enumerator = NULL;
ATLTRY (theEnumerator = new CComObject<IEnumFORMATETCImpl>);
if (theEnumerator == NULL)
return E_OUTOFMEMORY;
hResult = theEnumerator->QueryInterface (IID_IEnumFORMATETC, (void **)&result);
if (FAILED (hResult))
{
delete theEnumerator;
return hResult;
}
hResult = theEnumerator->Initialize (cfmt, afmt);
if (FAILED (hResult))
return hResult;
*enumerator = result.Detach ();
TRACE("(%p)->(%u,%p)\n", *enumerator, cfmt, afmt);
return S_OK;
}
示例6: TRACE
/**************************************************************************
* CFontsFolder::EnumObjects
*/
HRESULT WINAPI CFontsFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
{
CComObject<CDesktopFolderEnumZ> *theEnumerator;
CComPtr<IEnumIDList> result;
HRESULT hResult;
TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner, dwFlags, ppEnumIDList);
if (ppEnumIDList == NULL)
return E_POINTER;
*ppEnumIDList = NULL;
ATLTRY (theEnumerator = new CComObject<CDesktopFolderEnumZ>);
if (theEnumerator == NULL)
return E_OUTOFMEMORY;
hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
if (FAILED (hResult))
{
delete theEnumerator;
return hResult;
}
hResult = theEnumerator->Initialize (dwFlags);
if (FAILED (hResult))
return hResult;
*ppEnumIDList = result.Detach ();
TRACE ("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
return S_OK;
}
示例7: DELETE_OBJ
///////////////////////////////////////////////////////////////////////////////
// Geometriebaum (Quadtree)
BOOL CSpatialTree::Init (long lTileCnt, double *padfBoundsMin,
double *padfBoundsMax, int nMaxDepth)
{
DELETE_OBJ(m_psRoot);
_ASSERTE(NULL != padfBoundsMin && NULL != padfBoundsMax);
// If no max depth was defined, try to select a reasonable one
// that implies approximately 8 shapes per node.
if (0 == nMaxDepth) {
int nMaxNodeCount = 1;
while (4 * nMaxNodeCount < lTileCnt)
{
++nMaxDepth;
nMaxNodeCount = 2 * nMaxNodeCount;
}
}
m_nMaxDepth = nMaxDepth;
// Allocate the root node.
// Assign the bounds to the root node. If none are passed in,
// use the bounds of the provided file otherwise the create
// function will have already set the bounds.
ATLTRY(m_psRoot = new CSpatialTreeNode(padfBoundsMin, padfBoundsMax));
return (NULL != m_psRoot) ? TRUE : FALSE;
}
示例8: _InsertItem
EShellTreeItem _InsertItem(IShellFolder* pFolder, LPCITEMIDLIST pidlPath, LPCITEMIDLIST pidlNode,
DWORD dwAttribs, EShellTreeItem tiParent)
{
ATLASSERT(pFolder);
ATLASSERT(pidlPath);
// Create PARAM data
PSHELLITEMINFO pItem;
ATLTRY(pItem = new SHELLITEMINFO);
ATLASSERT(pItem);
pItem->pidlFull.Copy( pidlPath );
pItem->pidlFull.Concatenate( pidlNode );
pItem->pidlNode.Copy( pidlNode );
pItem->spFolder = pFolder;
pItem->dwAttribs = dwAttribs;
SHFILEINFO sfi;
if( ::SHGetFileInfo((LPCTSTR)(LPCITEMIDLIST)pItem->pidlFull, 0, &sfi, sizeof(sfi),
SHGFI_PIDL | SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX
| SHGFI_SMALLICON | SHGFI_LINKOVERLAY) )
{
return AppendItem(tiParent, sfi.szDisplayName, sfi.iIcon, pItem);
}
return NULL;
}
示例9: m_ptszClass
CKeyClass::CKeyClass(
CHKey& hk)
: m_ptszClass(NULL),
m_lErr(ERROR_SUCCESS)
{
DWORD ctc = 0;
if (! hk.QueryInfoKey(NULL, &ctc, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL))
{
m_lErr = hk.Error();
}
else
{
ATLTRY(m_ptszClass = new TCHAR [++ctc]);
if (m_ptszClass == NULL)
{
m_lErr = ERROR_OUTOFMEMORY;
return;
}
*m_ptszClass = _T('\0');
if (! hk.QueryInfoKey(m_ptszClass, &ctc, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL))
{
delete [] m_ptszClass;
m_ptszClass= NULL;
m_lErr = hk.Error();
}
}
}
示例10: if
bool CPEDebug::Initialize()
{
if (m_fIsInitialized)
return true; // nur einmal initialisieren
else if (m_fTriedToInitialize)
return false; // schon mal versucht, jedoch fehlgeschlagen
m_fTriedToInitialize = true;
// Since the largest symbol that the MS code generators can handle
// is 256 that is all that is needed.
ATLTRY(m_pSymbol = (IMAGEHLP_SYMBOL *)new BYTE [sizeof(IMAGEHLP_SYMBOL) + 256]);
if (NULL == m_pSymbol) return false;
// SymbolEngine initialisieren
if (m_SymEngine.SymInitialize (GetCurrentProcess(), NULL, TRUE)) {
// Set the symbol engine to load line information. This must be
// because the symbol engine does not load source-lines by default.
// I also turn on the OMAP lookups so that the super-special OMAP
// moved blocks will get looked at as well. Trust me, don't ask.
SymSetOptions (SymGetOptions() | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST);
m_fIsInitialized = true;
return true;
}
return false;
}
示例11: m_pSystem
COledbDatabase::COledbDatabase() :
m_pSystem(NULL)
{
ATLTRY(m_pErrors = new COledbErrors);
#ifdef _DEBUG
m_nRecordsets = 0;
#endif
}
示例12: _lcreat
bool CIdentsDBExtension::ExportDataSourceAsXml (LPUNKNOWN pIUnk, HPROJECT hPr, LPCSTR pFName, ULONG &rulCnt)
{
if (pIUnk) LPPROGRESSINDICATOR(pIUnk) -> ChangeText (PIFLAG_FILENAME, pFName);
// Datei bilden, wenn diese noch nicht existiert
int fh = _lcreat (pFName, 0);
if (fh < 0) return false;
bool fRet = false;
{
// hier geht's los
CXMLDocument Doc (fh); // <?xml ...?>
char cbBuffer[80]; // TRiAS Version, aktuelle Zeit
os_time_and_date now;
string resVersion (g_cbTRiAS);
ResString resTempl (IDS_SIGNONVERSION_MODAL, _MAX_PATH);
resVersion += ": ";
resVersion += resTempl;
ATLTRY(now = os_time_and_date::now());
strcpy (cbBuffer, resVersion.c_str());
strcat (cbBuffer, now.to_string(" %e. %B %Y, %T").c_str());
CXMLComment (fh, cbBuffer);
CXMLComment (fh, ResString (IDS_COPYRIGHT, 100)); // allgemeines Copyright
// DTD einfügen
CXMLRawData (fh, s_cbDTD);
// die eigentlichen Infos ausgeben
CXMLAttribute Attr ("Version", "1.0");
CXMLNode MainNode (fh, g_cbTRiASMetadata, Attr);
ENUMLONGKEY ELK;
EXPORTDATA ED;
ED.fh = fh;
ED.pIUnk = pIUnk;
ED.ulCnt = rulCnt;
ELK.eKey = 'i';
ELK.eFcn = (ENUMLONGKEYPROC)ExportIdentEntryAsXml;
ELK.ePtr = &ED;
fRet = DEX_EnumPBDDataEx (hPr, ELK);
rulCnt = ED.ulCnt;
}
// Datei wieder schließen
_lclose (fh); // Datei schließen
return fRet;
}
示例13: CreateInstance
CFindReplaceDlg *CFindReplaceDlg :: CreateInstance ()
{
CFindReplaceDlg *pCFindReplaceDlg = NULL;
ATLTRY(pCFindReplaceDlg = new CFindReplaceDlg());
if(pCFindReplaceDlg == NULL || !pCFindReplaceDlg -> FInit () ) {
if (pCFindReplaceDlg) delete pCFindReplaceDlg;
return NULL;
}
return pCFindReplaceDlg;
}
示例14: CSingleDocTemplate
CTRiASDocTemplate::CTRiASDocTemplate(UINT nIDResource,
CRuntimeClass* pDocClass, CRuntimeClass* pFrameClass,
CRuntimeClass* pViewClass)
: CSingleDocTemplate(nIDResource, pDocClass, pFrameClass, pViewClass)
{
// Zeichenketten korrigieren
if (m_strDocStrings.IsEmpty())
m_strDocStrings.LoadString(nIDResource);
ATLTRY(m_strDocStrings = FakeTRiASName (
m_strDocStrings, g_cbTRiAS, g_cbTRiAS, g_cbTRiAS,
g_cbRiw, g_cbRiw, g_cbTRiAS).c_str());
}
示例15: RemoveChunk
void CSketcherDoc::SetSearchContent(const CString& value)
{
if (value.IsEmpty()) {
RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid);
} else {
CMFCFilterChunkValueImpl *pChunk = NULL;
ATLTRY(pChunk = new CMFCFilterChunkValueImpl);
if (pChunk != NULL) {
pChunk->SetTextValue(PKEY_Search_Contents, value, CHUNK_TEXT);
SetChunkValue(pChunk);
}
}
}