the question that relate to CreateInstance
-
The following code is correct: FRLE_FALSE(m_pRssManager.CreateInstance(RssLib::CLSID_RssManager),_T("can't create RssManager object")); CString sRssDBFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\DB\\RssTab.mrr")); try{ m_pRssManager->Open((LPCTSTR)sRssDBFile); } catch(...) { MessageBox(::AfxGetMainWnd()->m_hWnd, _T("database file is already damaged,will create a new empty database file"),_T("message"),MB_OK|MB_ICONINFORMATION); CString sRssDBTemplateFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\NewRssTab.mrr")); if( ::PathFileExists(sRssDBTemplateFile) ){ ::CopyFile(sRssDBTemplateFile, sRssDBFile, FALSE); RssLib::IRssManagerPtr pRssManager; FRLE_FALSE(pRssManager.CreateInstance(RssLib::CLSID_RssManager),_T("can't create RssManager object")); pRssManager->Open((LPCTSTR)sRssDBFile); m_pRssManager = pRssManager; } } the following code is not correct: FRLE_FALSE(m_pRssManager.CreateInstance(RssLib::CLSID_RssManager),_T("can't create RssManager object")); CString sRssDBFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\DB\\RssTab.mrr")); try{ m_pRssManager->Open((LPCTSTR)sRssDBFile); } catch(...) { MessageBox(::AfxGetMainWnd()->m_hWnd, _T("database file is already damaged,will create a new empty database file"),_T("message"),MB_OK|MB_ICONINFORMATION); CString sRssDBTemplateFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\NewRssTab.mrr")); if( ::PathFileExists(sRssDBTemplateFile) ){ ::CopyFile(sRssDBTemplateFile, sRssDBFile, FALSE); m_pRssManager ->Open((LPCTSTR)sRssDBFile); } } May I ask the reason ? Why have to recreate the RssManager object ? thanks a lot!
sdfdsfsd
-
The following code is correct: FRLE_FALSE(m_pRssManager.CreateInstance(RssLib::CLSID_RssManager),_T("can't create RssManager object")); CString sRssDBFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\DB\\RssTab.mrr")); try{ m_pRssManager->Open((LPCTSTR)sRssDBFile); } catch(...) { MessageBox(::AfxGetMainWnd()->m_hWnd, _T("database file is already damaged,will create a new empty database file"),_T("message"),MB_OK|MB_ICONINFORMATION); CString sRssDBTemplateFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\NewRssTab.mrr")); if( ::PathFileExists(sRssDBTemplateFile) ){ ::CopyFile(sRssDBTemplateFile, sRssDBFile, FALSE); RssLib::IRssManagerPtr pRssManager; FRLE_FALSE(pRssManager.CreateInstance(RssLib::CLSID_RssManager),_T("can't create RssManager object")); pRssManager->Open((LPCTSTR)sRssDBFile); m_pRssManager = pRssManager; } } the following code is not correct: FRLE_FALSE(m_pRssManager.CreateInstance(RssLib::CLSID_RssManager),_T("can't create RssManager object")); CString sRssDBFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\DB\\RssTab.mrr")); try{ m_pRssManager->Open((LPCTSTR)sRssDBFile); } catch(...) { MessageBox(::AfxGetMainWnd()->m_hWnd, _T("database file is already damaged,will create a new empty database file"),_T("message"),MB_OK|MB_ICONINFORMATION); CString sRssDBTemplateFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\NewRssTab.mrr")); if( ::PathFileExists(sRssDBTemplateFile) ){ ::CopyFile(sRssDBTemplateFile, sRssDBFile, FALSE); m_pRssManager ->Open((LPCTSTR)sRssDBFile); } } May I ask the reason ? Why have to recreate the RssManager object ? thanks a lot!
sdfdsfsd
Try formatting the code using the 'code block' button, so that indents aren't lost - that is pretty much unreadable, which makes it unlikely that someone's going to answer your query.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Try formatting the code using the 'code block' button, so that indents aren't lost - that is pretty much unreadable, which makes it unlikely that someone's going to answer your query.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p