Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. the question that relate to CreateInstance

the question that relate to CreateInstance

Scheduled Pinned Locked Moved ATL / WTL / STL
databasequestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    weifirst
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • W weifirst

      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

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      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

      W 1 Reply Last reply
      0
      • S Stuart Dootson

        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

        W Offline
        W Offline
        weifirst
        wrote on last edited by
        #3

        thanks. this query is resolves. it is not relate com, it is other question.

        sdfdsfsd

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups